As a web developer, we spent our more than half the time in altering the user interface. Issues are always that things seen on different browsers are way different from each other. The way a browser renders any web document is its own.
A web document consists of 3 parts:
1. Structural layer (HTML or XHTML or XML)
2. Design Layer (CSS)
3. Behavior layer (JavaScript)
Here we are concerned with only the first layer.
This layer tells a web browser or user agent, a way to present the structure.
Try to use doctype in <>
!DOCTYPE html PUBLIC “-//W3C//Dtd XHTML 1.0 Strict//EN” “http://www.w3.org/tr/xhtml1/Dtd/xhtml1-strict.dtd”
html xmlns=”http://www.w3.org/1999/xhtml” lang=”en” xml:lang=”en”
Above line tells any browser, that document is of XHTML 1.0, hence it even tells the browser that how to behave or render upon the CSS layer. As XHTML is a form of XML language. It has some strict rules to follow upon.
1. It is case-sensitive.
2. Every open tag must be closed.
3. Please view W3C website for specifications on XHTML.
ALL *
We should follow * rule.
All browsers have different settings for different HTML tags. Like “P” may behave different in Firefox and Internet Explorer.
Example:
*{
Margin:0px;
Padding:0px;
}
<!–more–><!–more–><!–more–><!–more–>
JSON (JavaScript Object Notation) is a lightweight data-interchange format.
JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.
Area of use:Sending and Fetching AJAX request and response.
Advantage over XMLResponse Object: JSON doesn’t need a bit extra code to be manipulated by JavaScript on Client side, while manipulation of XML objects need minimum 4kb of script. As the number of browser in compatibility issue increases the size of script increases.
Sample PHP code:
$arr = array (’a'=>1,’b'=>2,’c'=>3,’d'=>4,’e'=>5);
echo json_encode($arr); // encode array to JSON string
Output:
{”a”:1,”b”:2,”c”:3,”d”:4,”e”:5}
Decode:
$json = ‘{”a”:1,”b”:2,”c”:3,”d”:4,”e”:5}’;
json_decode($json);
For further ref: JSON
CODE
function jsonRun(){
var myFirstJSON = eval({’myname’: ‘nirbhab’, ‘myfrnd’: ‘ankesh’});
var x;
for (x in myFirstJSON)
{
document.writeln(myFirstJSON[x]);
}
}
NOTE: Some servers doesn’t have json_encode() and json_decode functionality.
You can also use PEAR Service_JSON Class instead.
PEAR
Refer URL for advance Learning on JSON : http://www.hunlock.com/blogs/Mastering_JSON_(_JavaScript_Object_Notation_)
One Of the Classes must have Main method as a member. This is what we normally expect.
But C# includes a feature that enables us to define more than one class with Main method.
As all of we know that Main is the entry point for program execution, but in C# we can have now more than one entry points .In fact there should be only one.
The very problem can be resolved by specifying which main is to be used to the Compiler at the time of compilation.
csc filename.cs/main: classname
Filename- Name of file where code is stored.
Classname- Name of class containing main which we would like to be entry point for our execution.
To explain it further
Application with multiple main method
Using system;
Class class A
{
Public static void main()
{
Console.writeline(“class A”);
}
}
Class class B
{
Public static Void main()
{
Console.writeLine(“Class B”);
}
}
During compilation we can decide which main method we have to use or we want to use by switching as.
/main:classA or /main:class B