Programming Tutorials on XHTML, CSS, JavaScript, JQuery, JSON, Python, Django, Amazon Web Services, ASP.NET, Web Forms, and SQL
Wednesday, October 22, 2014
Thursday, November 28, 2013
What is Encapsulation?
Encapsulation means that a group of related properties,
methods, and other members treated as a single unit or object. This hides the
data from being accessed from outside a class directly, only through the
functions inside the class is able to access the information.
What is difference between class and object?
Class is a blue print or some template and object is a building
created from this blue print or template. Class is a more abstract definition
of something and object is the real thing that belongs to that class.
For example
Class:
class Bike {
}
Object:
Bike myObject = new Bike();
What is an Object in Object Oriented Programming?
Objects are usable instances of classes. Using the blue
print analogy, a class is a blueprint and object is building made from that
blue print. Classes describe the type of objects.
For example we have a class (say Bike)
class Bike {
}
Then we create object of this class as
Bike myObject = new Bike();
Objects share two characteristic. They have state and
behavior. An object stores its state in fields (variables) and exposes its
behavior through methods.
Software objects are conceptually similar to real world
objects. For example we have real world object Dog.
Dog has state name, color, breed, hungry and behavior barking, fetching, wagging tail
etc.
We represent it in software world as
class Dog
{
string name;
string color;
string breed;
string hungry;
void Barking()
{
//
function definition
}
void Fetching()
{
//
function definition
}
void Waggingtail()
{
//
function definition
}
}
Dog objDog = new Dog();
Saturday, November 9, 2013
What is Class?
A class is the blue print from where individual objects are
created. For example in real world, we
may find many individual objects of same kind. There may be thousands of bikes
in existence, all of the same make and model. Each bike was built from the same
set of blueprints and therefore contains the same component. In object oriented
terms, we say that our bike is an instance of the class of objects known as
bikes.
The following Bike class is one of implementation of a bike.
class Bike {
int Speed = 0;
int Gear = 0;
void SpeedUp(int increment)
{
Speed += increment;
}
void ApplyBreakes(int decrement)
{
Speed -= decrement;
}
}
Simple example of class is
class SampleClass {
}
What is Object Oriented Programming?
Object oriented programming is a programming language model
organized around objects rather than action, and data rather than logic. Objects
have both data fields and associated procedures called methods. Objects are
instances of classes and used to interact with one another to design applications
and computer programs.
Saturday, October 26, 2013
Key Concepts of Entity Data Model
The Entity Data Model (EDM) uses three key concepts to describe the structure of data: entity type, association type, and property. These are the most important concepts in describing the structure of data in any implementation of the EDM.
Entity Type
In a conceptual model, An entity represents a specific object (such as a specific customer or order). Each entity must have a unique entity key within an entity set.
Association
In a conceptual model, an association represents a relationship between two entity types (such as Customer and Order).
Property
Entity types contains properties that define the structure and characteristics of Entities. For example, a Customer entity type may have properties such as CustomerId, Name, and Address.
Entity Type
In a conceptual model, An entity represents a specific object (such as a specific customer or order). Each entity must have a unique entity key within an entity set.
Association
In a conceptual model, an association represents a relationship between two entity types (such as Customer and Order).
Property
Entity types contains properties that define the structure and characteristics of Entities. For example, a Customer entity type may have properties such as CustomerId, Name, and Address.
What are Advantages and Disadvantages of Entity Framework
There are several advantages and disadvantages of using Entity Framework.
Advantages
Advantages
- No need to write the Data access layer code. Entire Data access layer code will be generated by the Entity Designer (.edmx file).
- For small applications, no need to write Stored procedures for the CRUD opeartions (Insert,Update,Delete and modify). The Designer will provide the implementation. Developer need to consume those methods.
- Reduces development effort and Unit Testing effort.
- As the queries are dynamic there might be a hit in the performance of the application.
What is Microsoft ADO.NET Entity Framework
The Microsoft ADO.NET Entity Framework (EF) is an Object/Relational Mapping (ORM) framework that enables developers to work with relational data as domain-specific objects, eliminating the need for most of the data access plumbing code that developers usually need to write.
The Entity Framework works with Microsoft SQL Server and 3rd party databases through extended ADO.NET Data Providers, providing a common query language against different relational databases through either LINQ to Entities or Entity SQL.
The Entity Framework works with Microsoft SQL Server and 3rd party databases through extended ADO.NET Data Providers, providing a common query language against different relational databases through either LINQ to Entities or Entity SQL.
Thursday, May 23, 2013
Set and Get Textbox Value inside ascx Control from ASP.NET Page
Setting and getting Textbox value inside user control (ascx
control) from aspx page is a usual practice in both simple and complex
projects.
In this tutorial, we will
- Create New User Control.
- Add User Control in aspx Page.
- Set Textbox Value inside User Control
- Get Textbox value From User Control
Create New User Control
- Right Click on Project, Click Add New Item.
- A pop up window will be opened.
- Select Web User Control from list, change its Name to 'myControl' and click Add.
- Two files will be added with name 'myControl.ascx' and 'myControl.ascx.cs'
Replace the code in 'myControl.ascx' file with following code.
<%@ Control
Language="C#"
AutoEventWireup="true"
CodeFile="myControll.ascx.cs"
Inherits="Controls_myControll"
%>
<table>
<tr>
<td>
Name :
</td>
<td>
<asp:TextBox ID="txtName"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Age :
</td>
<td>
<asp:TextBox ID="txtAge" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Profession :
</td>
<td>
<asp:TextBox ID="txtProfession"
runat="server"></asp:TextBox>
</td>
</tr>
</table>
Add following code in 'myControl.ascx.cs' File.
Add following code in 'myControl.ascx.cs' File.
public string Name
{
get { return
txtName.Text.ToString(); }
set { txtName.Text = value;
}
}
public string Age
{
get { return
txtAge.Text.ToString(); }
set { txtAge.Text = value;
}
}
public string
Profession
{
get { return
txtProfession.Text.ToString(); }
set { txtProfession.Text = value;
}
}
Add User Control in aspx Page
- Create New aspx Page with name ‘PageForWebControl’.
- Open Design View and drag and drop user control on it. Some code will be added in 'PageForWebControl.aspx' page automatically.
Page will look
like this.
<%@ Page
Language="C#"
AutoEventWireup="true"
CodeFile="PageForWebControl.aspx.cs"
Inherits="PageForWebControl"
%>
<%@ Register
src="Controls/myControll.ascx"
tagname="myControll"
tagprefix="uc1"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD
XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc1:myControll ID="myControll1"
runat="server"
/>
</div>
</form>
</body>
</html>
Set Textbox Value inside User Control
Add following code snippet in Page Load Event of 'PageForWebControl.aspx' page to set Values of Textbox inside
User Control.
// Setting Values in ASCX Control
myControll1.Name = "Waqas Ali";
myControll1.Age = "24";
myControll1.Profession = "Computer
Scientist";
Get Textbox value From User Control
Add following code snippet in Page Load Event of PageForWebControl.aspx
page to get values of Textbox from User Control.
string _name = string.Empty;
int _age = 0;
string _profession = string.Empty;
// Getting Values from ASCX Control
_name
= myControll1.Name;
_age
= Convert.ToInt32(myControll1.Age);
_profession = myControll1.Profession;
Now you are all done. Run Project and test your values.
Now you are all done. Run Project and test your values.
Wednesday, May 22, 2013
Difference Between string and String in C#.NET
There is no different
between string and
String (System.String). string is
an alias for System.String in C#.Net.
They compile to the same code, so no difference at execution
time. The complete list of aliases in C#.Net is
object:System.Object
string:System.String
bool:System.Boolean
byte:System.Byte
sbyte:System.SByte
short:System.Int16
ushort:System.UInt16
int:System.Int32
uint:System.UInt32
long:System.Int64
ulong:System.UInt64
float:System.Single
double:System.Double
decimal:System.Decimal
char:System.Char
string:System.String
bool:System.Boolean
byte:System.Byte
sbyte:System.SByte
short:System.Int16
ushort:System.UInt16
int:System.Int32
uint:System.UInt32
long:System.Int64
ulong:System.UInt64
float:System.Single
double:System.Double
decimal:System.Decimal
char:System.Char
Thursday, May 2, 2013
ORA-00254 Error in Archive Control String
Error Code
ORA-00254
Description
Error in archive control string 'string'.
Cause
Possible cause of this error is, the specified archive log location is invalid in the archive command or the LOG_ARCHIVE_DEST initialization parameter.
Action
To fix this issue, check the archive string used to make sure it refers to a valid online device.
reference
ORA-00254
Description
Error in archive control string 'string'.
Cause
Possible cause of this error is, the specified archive log location is invalid in the archive command or the LOG_ARCHIVE_DEST initialization parameter.
Action
To fix this issue, check the archive string used to make sure it refers to a valid online device.
reference
ORA-00253 Character Limit String Exceeded by Archive Destination
Error Code
ORA-00253
Description
Character limit string exceeded by archive destination string string.
Cause
Possible cause of this error is, the destination specified by an ALTER SYSTEM ARCHIVE LOG START TO command was too long.
Action
To fix this issue, retry the ALTER SYSTEM command using a string shorter than the limit specified in the error message.
reference
ORA-00253
Description
Character limit string exceeded by archive destination string string.
Cause
Possible cause of this error is, the destination specified by an ALTER SYSTEM ARCHIVE LOG START TO command was too long.
Action
To fix this issue, retry the ALTER SYSTEM command using a string shorter than the limit specified in the error message.
reference
ORA-00252 Log String of Thread String is Empty
Error Code
ORA-00252
Description
Log string of thread string is empty, cannot archive.
Cause
Possible cause of this error is, a log must be used for redo generation before it can be archived. The specified redo log was not been used since it was introduced to the database. However it is possible that instance death during a log switch left the log empty.
Action
To fix this issue, empty logs do not need to be archived. Do not attempt to archive the redo log file.
reference
ORA-00252
Description
Log string of thread string is empty, cannot archive.
Cause
Possible cause of this error is, a log must be used for redo generation before it can be archived. The specified redo log was not been used since it was introduced to the database. However it is possible that instance death during a log switch left the log empty.
Action
To fix this issue, empty logs do not need to be archived. Do not attempt to archive the redo log file.
reference
ORA-00251 LOG_ARCHIVE_DUPLEX_DEST cannot be the Same Destination
Error Code
ORA-00251
Description
LOG_ARCHIVE_DUPLEX_DEST cannot be the same destination as string string.
Cause
Possible cause of this error is, the destination specified by the LOG_ARCHIVE_DUPLEX_DEST parameter is the same as the destination specified by an ALTER SYSTEM ARCHIVE LOG START TO command.
Action
To fix this issue, specify a different destination for parameter LOG_ARCHIVE_DUPLEX_DEST, or specify a different destination with the ALTER SYSTEM command.
reference
ORA-00251
Description
LOG_ARCHIVE_DUPLEX_DEST cannot be the same destination as string string.
Cause
Possible cause of this error is, the destination specified by the LOG_ARCHIVE_DUPLEX_DEST parameter is the same as the destination specified by an ALTER SYSTEM ARCHIVE LOG START TO command.
Action
To fix this issue, specify a different destination for parameter LOG_ARCHIVE_DUPLEX_DEST, or specify a different destination with the ALTER SYSTEM command.
reference
ORA-00250 Archiver not Started
Error Code
ORA-00250
Description
Archiver not started.
Cause
Possible cause of this error is, an attempt was made to stop automatic archiving, but the archiver process was not running.
Action
No action required.
reference
ORA-00250
Description
Archiver not started.
Cause
Possible cause of this error is, an attempt was made to stop automatic archiving, but the archiver process was not running.
Action
No action required.
reference
ORA-00238 Operation would Reuse a Filename that is Part of the Database
Error Code
ORA-00238
Description
Operation would reuse a filename that is part of the database.
Cause
Possible cause of this error is, the filename supplied as a parameter to the ALTER DATABASE BACKUP CONTROLFILE command or to cfileSetSnapshotName matches the name of a file that is currently part of the database.
Action
To fix this issue, retry the operation with a different filename.
reference
ORA-00238
Description
Operation would reuse a filename that is part of the database.
Cause
Possible cause of this error is, the filename supplied as a parameter to the ALTER DATABASE BACKUP CONTROLFILE command or to cfileSetSnapshotName matches the name of a file that is currently part of the database.
Action
To fix this issue, retry the operation with a different filename.
reference
Wednesday, May 1, 2013
ORA-00237 Snapshot Operation Disallowed Control File Newly Created
Error Code
ORA-00237
Description
Snapshot operation disallowed, control file newly created.
Cause
Possible cause of this error is, an attempt to invoke cfileMakeAndUseSnapshot with a currently mounted control file that was newly created with CREATE CONTROLFILE was made.
Action
To fix this issue, mount a current control file and retry the operation.
reference
ORA-00237
Description
Snapshot operation disallowed, control file newly created.
Cause
Possible cause of this error is, an attempt to invoke cfileMakeAndUseSnapshot with a currently mounted control file that was newly created with CREATE CONTROLFILE was made.
Action
To fix this issue, mount a current control file and retry the operation.
reference
Tuesday, April 30, 2013
ORA-00236 Snapshot Operation Disallowed Mounted Control File is a Backup
Error Code
ORA-00236
Description
Snapshot operation disallowed, mounted control file is a backup.
Cause
Possible cause of this error is, attempting to invoke cfileSetSnapshotName, cfileMakeAndUseSnapshot, or cfileUseSnapshot when the currently mounted control file is a backup control file.
Action
To fix this issue, mount a current control file and retry the operation.
reference
ORA-00236
Description
Snapshot operation disallowed, mounted control file is a backup.
Cause
Possible cause of this error is, attempting to invoke cfileSetSnapshotName, cfileMakeAndUseSnapshot, or cfileUseSnapshot when the currently mounted control file is a backup control file.
Action
To fix this issue, mount a current control file and retry the operation.
reference
ORA-00235 Control File Fixed Table Inconsistent due to Concurrent Update
Error Code
ORA-00235
Description
Control file fixed table inconsistent due to concurrent update.
Cause
Possible cause of this error is, concurrent update activity on a control file caused a query on a control file fixed table to read inconsistent information.
Action
To fix this issue, retry the operation.
reference
ORA-00235
Description
Control file fixed table inconsistent due to concurrent update.
Cause
Possible cause of this error is, concurrent update activity on a control file caused a query on a control file fixed table to read inconsistent information.
Action
To fix this issue, retry the operation.
reference
ORA-00234 Error in Identifying or Opening Snapshot or Copy Control File
Error Code
ORA-00234
Description
Error in identifying or opening snapshot or copy control file
Cause
Possible cause of this error is, a snapshot or copy control file of the specified name could not be found or opened during an invocation of cfileUseSnapshot, cfileMakeAndUseSnapshot, or cfileUseCopy.
Action
To fix this issue, re-create the snapshot or copy control file using cfileMakeAndUseSnapshot or ALTER DATABASE BACKUP CONTROLFILE, respectively.
reference
ORA-00234
Description
Error in identifying or opening snapshot or copy control file
Cause
Possible cause of this error is, a snapshot or copy control file of the specified name could not be found or opened during an invocation of cfileUseSnapshot, cfileMakeAndUseSnapshot, or cfileUseCopy.
Action
To fix this issue, re-create the snapshot or copy control file using cfileMakeAndUseSnapshot or ALTER DATABASE BACKUP CONTROLFILE, respectively.
reference
ORA-00233 Copy Control File is Corrupt or Unreadable
Error Code
ORA-00233
Description
Copy control file is corrupt or unreadable.
Cause
Possible cause of this error is, the specified copy control file was found to be corrupt or unreadable during an invocation of cfileUseCopy.
Action
To fix this issue, before retrying cfileUseCopy, use the ALTER DATABASE BACKUP CONTROLFILE command and specify the same filename that was specified for cfileUseCopy.
reference
ORA-00233
Description
Copy control file is corrupt or unreadable.
Cause
Possible cause of this error is, the specified copy control file was found to be corrupt or unreadable during an invocation of cfileUseCopy.
Action
To fix this issue, before retrying cfileUseCopy, use the ALTER DATABASE BACKUP CONTROLFILE command and specify the same filename that was specified for cfileUseCopy.
reference
ORA-00232 Snapshot Control File is Nonexistent Corrupt or Unreadable
Error Code
ORA-00232
Description
Snapshot control file is nonexistent, corrupt, or unreadable.
Cause
Possible cause of this error is, the snapshot control file was found to be nonexistent, corrupt, or unreadable during an invocation of cfileUseSnapshot.
Action
To fix this issue, call cfileMakeAndUseSnapshot again or for the first time.
reference
ORA-00232
Description
Snapshot control file is nonexistent, corrupt, or unreadable.
Cause
Possible cause of this error is, the snapshot control file was found to be nonexistent, corrupt, or unreadable during an invocation of cfileUseSnapshot.
Action
To fix this issue, call cfileMakeAndUseSnapshot again or for the first time.
reference
Monday, April 29, 2013
ORA-00231 Snapshot Control File has not been Named
ErrorCode
ORA-00231
Description
Snapshot control file has not been named.
Cause
Possible cause of this error is, during an invocation of cfileMakeAndUseSnapshot or cfileUseSnapshot it was detected that no filename for the snapshot control file had previously been specified.
Action
To fix this issue, specify a name for the snapshot control file by calling cfileSetSnapshotName.
reference
ORA-00231
Description
Snapshot control file has not been named.
Cause
Possible cause of this error is, during an invocation of cfileMakeAndUseSnapshot or cfileUseSnapshot it was detected that no filename for the snapshot control file had previously been specified.
Action
To fix this issue, specify a name for the snapshot control file by calling cfileSetSnapshotName.
reference
ORA-00230 Operation Disallowed Snapshot Control File Enqueue Unavailable
Error Code
ORA-00230
Description
Operation disallowed, snapshot control file enqueue unavailable.
Cause
Possible cause of this error is, the attempted operation cannot be executed at this time because another process currently holds the snapshot control file enqueue.
Action
To fix this issue, retry the operation after the concurrent operation that is holding the snapshot control file enqueue terminates.
reference
ORA-00230
Description
Operation disallowed, snapshot control file enqueue unavailable.
Cause
Possible cause of this error is, the attempted operation cannot be executed at this time because another process currently holds the snapshot control file enqueue.
Action
To fix this issue, retry the operation after the concurrent operation that is holding the snapshot control file enqueue terminates.
reference
ORA-00229 Operation Disallowed Already Hold Snapshot Control File Enqueue
Error Code
ORA-00229
Description
Operation disallowed already hold snapshot control file enqueue.
Cause
Possible cause of this error is, the attempted operation cannot be executed at this time because this process currently holds the snapshot control file enqueue.
Action
To fix this issue, retry the operation after calling cfileUseCurrent to release the snapshot control file enqueue.
reference
ORA-00229
Description
Operation disallowed already hold snapshot control file enqueue.
Cause
Possible cause of this error is, the attempted operation cannot be executed at this time because this process currently holds the snapshot control file enqueue.
Action
To fix this issue, retry the operation after calling cfileUseCurrent to release the snapshot control file enqueue.
reference
ORA-00228 Length of Alternate Control File Name Exceeds Maximum of String
Error Code
ORA-00228
Description
Length of alternate control file name exceeds maximum of string.
Cause
Possible cause of this error is, the specified filename, which was supplied as a parameter to cfileSetSnapshotName or cfileUseCopy, exceeds the maximum filename length for this operating system.
Action
To fix this issue, retry the operation with a shorter filename.
reference
ORA-00228
Description
Length of alternate control file name exceeds maximum of string.
Cause
Possible cause of this error is, the specified filename, which was supplied as a parameter to cfileSetSnapshotName or cfileUseCopy, exceeds the maximum filename length for this operating system.
Action
To fix this issue, retry the operation with a shorter filename.
reference
ORA-00227 Corrupt Block Detected in Control File
Error Code
ORA-00227
Description
Corrupt block detected in control file: (block string, # blocks string).
Cause
Possible cause of this error is, a block header corruption or checksum error was detected on reading the control file.
Action
To fix this issue, use the CREATE CONTROLFILE or RECOVER DATABASE USING BACKUP CONTROLFILE command.
reference
ORA-00227
Description
Corrupt block detected in control file: (block string, # blocks string).
Cause
Possible cause of this error is, a block header corruption or checksum error was detected on reading the control file.
Action
To fix this issue, use the CREATE CONTROLFILE or RECOVER DATABASE USING BACKUP CONTROLFILE command.
reference
Subscribe to:
Posts (Atom)