Thursday, 23 May 2013

AJAX


What is AJAX?
AJAX = Asynchronous JavaScript and XML.

AJAX is a technique for creating fast and dynamic web pages.

AJAX allows web pages to be updated asynchronously by exchanging small amounts of data with the server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page.

Classic web pages, (which do not use AJAX) must reload the entire page if the content should change.

Examples of applications using AJAX: Google Maps, Gmail, Youtube, and Facebook tabs.


The XMLHttpRequest Object
All modern browsers support the XMLHttpRequest object (IE5 and IE6 use an ActiveXObject).

The XMLHttpRequest object is used to exchange data with a server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page.


The onreadystatechange event
When a request to a server is sent, we want to perform some actions based on the response.

The onreadystatechange event is triggered every time the readyState changes.

The readyState property holds the status of the XMLHttpRequest.

Three important properties of the XMLHttpRequest object:

Property Description
onreadystatechange Stores a function (or the name of a function) to be called automatically each time                                                                the readyState property changes

readyState Holds the status of the XMLHttpRequest. Changes from 0 to 4:
0: request not initialized
1: server connection established
2: request received
3: processing request
4: request finished and response is ready

status 200: "OK"
404: Page not found

Difference between Server side scripting and Client side scripting


We would define a script as a set of instructions. For Web pages they are instructions either to the Web server(server-side scripting) or to the Web Browser (client-side scripting). Let’s have a look how they differ from each other :

>> Server side scripting is used to create dynamic pages based a number of conditions when the users browser makes a request to the server.
Client side scripting is used when the users browser already has all the code and the page is altered on the basis of the users input.
>> The Web Server executes the server side scripting that produces the page to be sent to the browser.
The Web Browser executes the client side scripting that resides at the user’s computer.
>> Server executes server-side scripts to send out a page but it does not execute client-side scripts.
The browser receives the page sent by the server and executes the client-side scripts.
>> Server side scripting is used to connect to the databases that reside on the web server.
Client side scripting cannot be used to connect to the databases on the web server.
>> Server side scripting can access the file system residing at the web server.
Client side scripting can’t access the file system that resides at the web server.
>> The  settings that belong to Web server can be accessed using Server side scripting.
The files and settings that are local at the user’s computer can be accessed using Client side scripting.
>> Examples of Server side scripting languages : PHP, JSP,  ASP, ASP.Net, Ruby, Perl n many more.
Examples of Client side scripting languages : Javascript, VB script, etc.

Sunday, 5 May 2013

70-480 Programming in HTML5 with JavaScript and CSS3


It is quite good to appear for the professional certification Exams. On April 20 th I have cleared my first certification in ‘Programming in HTML5 with JavaScript and CSS3’

Here I have shared some quick steps for those who like to appear for these exams.

How to register?

1. You need to register first for the exam from a Prometric center, like http://register.prometric.com/

2. Follow the registration steps and choose your convinient date/time available there. If you have promo code or any voucher code, you can enter while registering for the exam so the exam fees will be 0!

3. Once registered, you will receive  an email from the prometric site with details entered while registering.

How to prepare?

Generally preparation depends upon the exam selected.

You can read dumps! dumps are something like previous exam papers of the MS exams appeared. Users post latest dumps online. One of the site to refer dumps is http://examcollection.com. It gives a list of the dumps posted by date. Its a really good practice to follow these dumps to at least score passing marks for MS exams. Passing score is 700 out of 1000. Time duration is 2 hours and number of questions is 39.

How to get Certificate?

After completion of the exam, if you are passed, you will be given marksheet/report from the prometric center and you will recieve the mail from MS.
Approx in 7 working days, you will recieve the mail and it will have your MC ID and access code which you need to enter on the MCP site – mcp.microsoft.com

You will get digital copy (PDF format) of your certificate as well transcript etc from there.


All the best!!

Monday, 8 April 2013

Amazing HTML5 tags

Auto Complete Feature:

The <datalist> tag is used to provide an "autocomplete" feature on <input> elements. Users will see a drop-down list of pre-defined options as they input data.

Example code:


<form action="demo_form.asp" method="get">
<input list="browsers" name="browser">
<datalist id="browsers">
  <option value="Internet Explorer">
  <option value="Firefox">
  <option value="Chrome">
  <option value="Opera">
  <option value="Safari">
</datalist>
<input type="submit">
</form>

For Calculation:

The <output> tag represents the result of a calculation (like one performed by a script).

Example code:


<form oninput="x.value=parseInt(a.value)+parseInt(b.value)">0
<input type="range" id="a" value="50">100
+<input type="number" id="b" value="50">
=<output name="x" for="a b"></output>
</form>

Sunday, 7 April 2013

String pad in java


public class Trial {
    public static void main(String arg[])
    {
        String password="password";
        String padded=String.format("%"+password.length()+"s","").replace(" ", "*");
        System.out.println(padded);
    }
}

Output:


run:
********
BUILD SUCCESSFUL (total time: 0 seconds)


Different types:


     String.format("%10s", "foo").replace(' ', '*');
     String.format("%-10s", "bar").replace(' ', '*');
     String.format("%10s", "longer than 10 chars").replace(' ', '*');

     Output:

        *******foo
        bar*******
        longer*than*10*chars



Monday, 1 April 2013

Sample html webpage with div tag(Containers)


<!DOCTYPE html>
<html>
<body>
<div id="container" style="width:1350px">
<div id="header" style="background-color:#FFA500;">
<h1 style="margin-bottom:0;">Main Title of Web Page</h1>
</div>
<div id="menu" style="background-color:#FFD700;height:550px;width:200px;float:left;">
<b>Menu</b><br>
HTML<br>
CSS<br>
JavaScript
</div>
<div id="content" style="background-color:#EEEEEE;height:550px;width:1150px;float:left;">
Content goes here
</div>
<div id="footer" style="background-color:#FFA500;clear:both;text-align:center;">
Copyright © W3Schools.com
</div>
</div>
</body>
</html>

Tuesday, 12 March 2013

Creating Master Page In ASP.NET 2010


Introduction
ASP.NET programming language is composed of different suite packages of programming tools. However, the most exciting thing to learn from this language is to create a website because you don’t have to put in a lot of effort for building a complex website. In this language, you don’t need to find some flat form in order to make a beautiful and flexible website because there is already a package on how we are going to handle and locate those important matters to build a website. The advantages of why ASP.NET is popular? It’s because, you can write least amount of code. Unfortunately, it depends on the programmer side which programming tools they are going to choose. The most interesting part of ASP.NET Web programming is the use of Master Page. The master page is the template for how your pages will look like. It enables you to store the same content among multiple content pages in a website.
For instance, if you would like to display a standard header and footer in each page of your website, then you can generate the standard header and footer in a Master Page. That’s how powerful a master page is to handle multiple forms and is easier to maintain throughout what the website looks like. Take note, the ID attribute uniquely identifies the placeholder, allowing you to put more than one placeholder in a master page.
To start - open your Visual Studio 2010, File and choose New Web Site, choose C#.

Choose ASP.NET Empty Web Site. Make the default File System; you can change the file directory of your file. Just simply browse and name your folder where your file is being saved and click Ok.

When we notice there’s no display, what are we going to do. We are going to Add a Master Page. To do that, in your solution explorer, right click the name of your website and choose Add new item. Choose MasterPage.master, the default name is MasterPage. Make sure that the check box is checked, only place code in a separate file, not a selectmaster page.
This is the master build in code:
http://www.codeproject.com/images/minus.gif Collapse | Copy Code
<%@ Master Language="C#" AutoEventWireup="true"
    CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!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>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">

        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>
Under the code, either you can choose Source, Split, and design. In order to show only the code, use the design just like above, split shows both source and design and design shows only a design.
Now, we are going to use design in order to see the full design of our Master Page. Click design; first delete the current placeholder because we are going to create a new one.
In the above menu, click table and insert table:

Click Ok, we are going to merge cells, the header and footer. Highlight the entire first row, right click and choose modify merge cells. Expand the height - it looks like a website and fill some color to make it look like an interesting site, look at the properties settings. If you want to add color for header and footer, click the cells and locate the properties and choose Bgcolor.
In toolbox, choose Hyperlink and drag in your Page. Make 3 copies and name them Home, About, and Settings.

So, this is how your Master Page looks like. In order to make multiple Web Forms, in your Solution Explorer, click your web site name, right click and Add new item. Choose C# and click Web Form. The default name is default, change it to Home to make it more meaningful. Remember; make sure to check the select master page and Add. When you notice another dialog box appears, it does mean that you are in the Master Page control. Click MasterPage.master, then Ok.
This is the build in code.
http://www.codeproject.com/images/minus.gif Collapse | Copy Code
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master"
    AutoEventWireup="true" CodeFile="Home.aspx.cs" Inherits="Home" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
Do the same procedure like what you created in the Home web form and name it About and Setting. Now you’ve already created 3 Web Forms.
Back to the Master Page, drag Content PlaceHolder from your toolbox in your Master Page.
Gdf

Click Home menu hyperlinks, in your properties setting, locate Navigate URL, click … and choose Home Web Form that corresponds to your menu. Do the same procedure when you link About and Settings Menu.

In Solution Explorer, double click Home Web Form. When you notice your cursor, only ContentPlaceHolder is active, it means you could not write anything except the place holder. Now, we are going to put something in the place holder. Type “This is my Home Page”, do the same as what you created in your home web form and type that relate in every pages.
Note: If you couldn’t write in the placeholder, click the place holder and click the greater than arrow >.
Save your work.
Now, click debug to start debugging or press F5 to run you program. The first time you run your program, it shows dialog box, click ok to continue. Then the output of your program looks like:

Kiro - Core Features

What is Kiro Kiro is an innovative AI-powered IDE that revolutionizes software development through intelligent assistance and structured wor...