Thursday, March 22, 2012

Response.Redirect Vs Server.Transfer



Response.Redirect Vs Server.Transfer




Server.Transfer: Transferring to another page using Server.Transfer conserves server resources. The transfer takes place on the server instead of forcing the browser to redirect to a new page. This means fewer HTTP requests coming through and can make your applications run more efficiently. Server.Transfer maintains to original URL in the browser.

Note:Only data transferred to a second ASP page are the ASP built-in objects and the ASP Error object values from the first request. Any variables declared by the first ASP page are not available in the second ASP page.

Server.Transfer has several advantages over Response.Redirect:
1) Because it saves a round trip between the server and the browser it's faster and reduces the load on the Web server.
2) The Response querystring and form collections are preserved during the transfer. As a result, you don't need to worry about reposting form and querystring data to the new page.

However, Server.Transfer does have a few disadvantages:

1) You can only use Server.Transfer to redirect to a page on the same Web server.
2) You can't pass a querystring to the new page. (However, remember that the querystring passed to the page executing the transfer will automatically be passed along to the new page.) If you try to pass a querystring to the new page, you will trigger an ASP error.
3) The browser is never notified of the new page, which can cause problems with relative links in some cases.
Note: Please 3rd point to noted very carefully



Wednesday, March 21, 2012

VBScript - ByVal Vs ByRef



VBScript - ByVal Vs ByRef




Passing Parameters ByRef and ByVal

In VBScript, there are two ways values can be passed:
1) ByVal

2) ByRef

Using ByVal, we can pass arguments as values whereas with the use of ByRef, we can pass arguments are references.
ByVal:

the parameter is passed by value, thus the subroutine works with a copy of the original.
ByRef:

the parameter is passed by reference, thus the subroutine works directly with the original.


Example: Parameters By Value


Function GetValue( ByVal var )
var = var + 1
End Function

Dim x: x = 5

'Pass variable x to GetValue function ByVal
GetValue x

Response.write "x = " & x

Output: x = 5


Example: Parameters By Reference:


Function GetReference( ByRef var )
var = var + 1
End Function

Dim x: x = 5

'Pass the variable x to the GetReference function ByRef
GetReference x

Response.write x

Output: 6


Tuesday, March 20, 2012

Create Array in New Style Using VB Script / Java Script



Create VBScript and JScript Arrays in modern style



Now we can create Array in modern style in VB script and JavaScript also, using this way we can reduce line of code, to make our program efficiency. For Example:
Create Array in JavaScript:

Var NakshtraName
NakshtraName = new Array("Ashwini", "Bhairini", "Krittika", "Rohini", "Mrigashirsha", "Aardhra", "Punarvasu", "Pushya", "Ashlesha", "Magha", "Purva Phalguni", "Uttara Phalguni", "Hastha", "Chitra", "Swati", "Vishaka", "Anuradha", "Jyestha", "Moola", "Purva Ashadha", "Uttara Ashadha", "Shravana", "Dhanista", "Shathabhisha", "Purva Bhadrapad", "Uttara Bhadrapada", "Revati");

Create Array in VB Script:

Dim NakshtraName

NakshtraName = Array("Ashwini", "Bhairini", "Krittika", "Rohini", "Mrigashirsha", "Aardhra", "Punarvasu", "Pushya", "Ashlesha", "Magha", "Purva Phalguni", "Uttara Phalguni", "Hastha", "Chitra", "Swati", "Vishaka", "Anuradha", "Jyestha", "Moola", "Purva Ashadha", "Uttara Ashadha", "Shravana", "Dhanista", "Shathabhisha", "Purva Bhadrapad", "Uttara Bhadrapada", "Revati")



Friday, March 2, 2012

VB Script | Interview Questions of VBScript | VBScriptDipak



VB Script | Interview Questions of VBScript | VBScriptDipak




1. Which command is used for writing text on a page?
Document.Write (text)

2. What is VBScript?
VBScript stands for Visual Basic Scripting Edition. It is an Active Scripting language, which is developed by Microsoft.
VBScript has been installed by default in every desktop release of Microsoft Windows.
VBScript language is a lightweight programming language, the newest member of the Visual Basic family of
programming languages, brings active scripting to a wide variety of
environments, including Web client scripting in Microsoft IE version 3.0 and Web server scripting in Microsoft Internet
Information Server version 3.0.

3. What is the difference between function and procedure in vb script?

Functions must be set equal to a return value while a procedure does not.

4. Declare a class in VBScript?
Class, refers to any object that you create using the Class ... End Class statement.
Class User
' declare private class variable
Private m_userName
' declare the property
Public Property Get UserName
UserName = m_userName
End Property
Public Property Let UserName (strUserName)
m_userName = strUserName
End Property
' declare and define the method
Sub DisplayUserName
Response.Write UserName
End Sub
End Class

Dim obj
Set obj = New User
' set the UserName property
obj.UserName = "Deepak Madheshiya"
' call the DisplayUserName method
' to print the user name
obj.DisplayUserName

5. VBScript is a case-sensitive programming language or not?
VBScript is not case-sensitive programming language.

6. How many ways you to create an Array in VBScript?
1st way:
Dim myArray(3)
myArray(0) = "Apple"
myArray(1) = "Banana"
myArray(2) = "Cat"
myArray(3) = "Dog"

2nd Way:
myArray = Array(5,10,15,20)

7. What is Dictionary object?
The Dictionary object are those objects who stores name and value in pairs in an array. Value pairs means key and item
Write the below code in a notepad and save it with .vbs extension and run it from
Command Prompt.
Dim wine
Set wine = CreateObject("Scripting.Dictionary")
Beers.Add "a", "Strauss"
Beers.Add "b", "Kingfisher"
Beers.Add "c", "Budweiser"
Msgbox ("The value corresponding to the key 'b' is " & wine.Item("b"))
Dictionary object properties:Count, Item, CompareMode etc.
Dictionary object methods:Exists, Add,Keys etc.

8. What is the difference between dictionary and an array object?
Dictionary object can not be multidimensionalArray object can be multidimensional
Dictionary has extra methods like add, checkNot in Array object
When you delete any specific item from dictionary, all the subsequent items automatically
shift up.
Not in Array

9. What is "On Error Resume Next" statement in VBScript?
When an error occurs, by using this statement, the line of code containing the error
is simply skipped over and the program continues.

10. Which object provide information single runtime error in a VBScript?
Err Object

11. What is difference between VBScript and VBA?
Visual Basic is a standalone tool for creating separate
software components such as executable programs, COM
components and ActiveX? Controls. It is useful when
building a specialised solution from scratch.
VBA offers the same powerful tools as Visual Basic in the context of
an existing application and is the best option for
customising software that already meets most needs.
VBScript is a lightweight version of the Visual Basic
language designed specifically for use on web pages. While
VBScript can sometimes be used for simple automation, VBA
is the premier technology designed specifically for
application automation.
VBScript doesn't have a debugger like Visual BasicVisual Basic and Visual Basic for Applications, in which the developer can
define the data type
12. What are the Data Types in VBScript?
VBScript has only one Variant datatype. There are different categories
of Variant datatype:
String, Integer, Null, Boolean, Empty, Byte, Long Single, Double, Date/Time, Currency, Object and Error.

13. Which function allows you to instantiate an object in VBScript?

CreateObject function


Thursday, March 1, 2012

Basic of Canvas Element in HTML5



Solid Understanding of the Basics of Canvas Element in HTML5




HTML5 Canvas

Canvas element is useful for draw graphics on a web pages. With the help of canvas element we can draw rectangular area, and also control each and every pixels. It have various methods to draw any graphics.
Whenever we are going to draw any graphics first of all we should create Canvas element like:
< canvas id="CanvasID" width="100" height="100">< /canvas>
Canvas element have no drawing capability. So we must be done it in javaScript method like:



< script type="text/javascript">
var canId=document.getElementById("CanvasID");
var cantext= canId.getContext("2d");
cantext.fillStyle="#FF0000";
cantext.fillRect(0,0,180,95);
< /script>
Basically JavaScript uses id to find the canvas element:

Solid Understanding of the Basics of HTML5 Part 1



Solid Understanding of the Basics of HTML5 | Let us play with HTML5




HTML5 Introduction

HTML5 is advanced of HTML. It is the new standared for HTML. Now days most modern browsers have support. Example, Crome, Mozila 10.0.2, IE 9.
There are following Rules for HTML 5, which is given bellow:-
1) There are some new features based on HTML, CSS, DOM, JavaScript
2) Best way to Error handling
3) HTML5, device independent
4) Reduce external Plugins

What new features is in HTML 5?

There are some following new features in HTML5:
1) Canvas element for drawing charts according to user preference.
2) The most powerful feature audio and video elements for media.
3) Best support for local offline storage.
4) Add new tag elements.
5) Add new form controls.

List of new tag elements

Media Elements Tags in HTML 5
1)< audio >
2)< video >
3)< source >
4)< embed >
5)< track >
Canvas Element Tags in HTML 5
1)< canvas>
Form Elements Tags in HTML 5
1)< datalist>
2)< keygen>
3)< output>
Input Type Attribute Values in HTML 5
1) tel
2) search
3) url
4) email
5) datetime
6) date
7) month
8) week
9) time
10) datetime-local
11) number
12) range
13) color
14) placeholder
< video> - Methods, Properties, and Events Tags in HTML 5
1) play()
2) pause()
3) load()
4) canPlayType
< video> Properties in HTML 5
1) currentSrc
2) currentTime
3) videoWidth
4) videoHeight
5) duration
6) ended
7) error
8) paused
9) muted
10) seeking
11) volume
12) height
13) width
< video> Events in HTML 5
1) play
2) pause
3) progress
4) error
5) timeupdate
6) ended
7) abort
8) empty
9) emptied
10) waiting
11)oadedmetadata

Example:















Tuesday, February 28, 2012



Learn RSS - RSS Tutorial - Free RSS Tutorial




What is RSS?

RSS stand for Really Simple Syndication. Basic definition of RSS is that Simply RSS is a method which use XML to distribute web of one web site to many other web sites.
It gives us an easy way to share and view headlines and content.
Really Simple Syndication(RSS) files can updated automatically.
We can use RSS personal views for different sites.
RSS is can also written in XML.
With the help of RSS we can perform fast browsing for news and also use to update them.
With the help of RSS we can syndicate our site content

copyright element in RSS?

All rights reserved by R4R

image element in RSS?

Display an image when aggregators presents a RSS feed. To define element tag to use these three child elements.
: used to define the URL of image.
: use to define the text to display if an image can not be shown.<br /> <link>: used to define the hyperlink to the website that offers the channel.<br /> feg.<url>Image path</url><br /> <title>r4r.co.in
site link

language element in RSS?

en-uk

item element in RSS?

Define an element we must have to use these three child element.
1.: This is used to define the title of item.<br /> 2.<link>: This is use to define the hyperlink to the item.<br /> 3.<description>: This is use to describe an item.<br /> Exe: This example explain how to use <item> element in RSS.<br /> <?xml version="1.0" encoding="ISO-8859-1" ?><br /> <rss version="2.0"><br /> <channel><br /> <title>Home Page of R4R
http://www.astrosage.com
huge collection of interview questions

RSS title
http://www.astrosage.com/rss
RSS ...



Category element in RSS?

RSS we use child element to define category for your RSS.
Using element RSS aggregator can grouped the web sites on the base of category.
How to define element in RSS document?
Web Designing
Learn SQL SERVER 2008 Tutorials


Better Coding in Classic ASP!



Tips For Better Coding in Classic ASP!



how we do Better Coding in Classic ASP!

  • Database in Session or App. Say NO!
  • Cache No More
  • Use Option Explicit
  • Encode with Redirects
  • Write Your SQL
  • Named constants for ADO are better
  • Clean Up Objects
  • Server.MapPath is Good
  • Just Say No to Session COM objects
  • Don't Read COM Properties Twice
  • Secure Code and Data
  • Encaspulate Code!
  • CASE reads better than IF
  • Error Trapping Strategies
  • Error Trapping Secrets

Classic ASP Objects Part 1



<br /> Classic ASP Objects<br /> meta name="Keywords" content="classic asp objects, html,css,tutorial,html5,dhtml,<br /> asp,ado,vbscript,dom,sql,beginner's guide,primer,lessons,examples,samples,source code,tags,demos,tips,<br /> links,FAQ,tag list,forms,frames,active server pages,dynamic html,<br /> internet,database,classic asp guide" /><br /> <meta name="Description" content="Learn about classic asp objects." /><br />


Classic ASP Object:


Response Object:
Basicaly we are using ASP Response object to send output to the user from the server.
response.write alternate syntax <%= %>
Example:

<% response.write("Hello New Programmer...!") %>.
Method for Response Object

1)AddHeader:- Adds HTTP header abd HTTP response

2)AppendToLog:- Adds a string to the end of the server log entry

3)BinaryWrite:- Writes data, without any character conversion

4)Clear:- Clears any buffered HTML output

5)End :- Stops the current processing a script.

6)Flush:- Sends buffered output immediately

7)Redirect:- Redirects the user to a different URL intrire a application

8)Write:- Writes a specified string


Request Object:


Request Object:
Request object is used to get information from a user or visiter.
There are various collection for Request Objects:
Requesr.form("name")
Request.QueryString("name")
Request.cookies("cookiesname")
Request.ServerVariables (server_variable)
There are only ine method for Request object
BinaryRead : Retrieves the data sent to the server from the client.
<% dim a,b a=Request.TotalBytes b=Request.BinaryRead(a) %>


ASP Application Object:

ASP Application Object:

The Application object holds information that will be used by many pages in the application (like database connection information). The information can be accessed from any page. The information can also be changed in one place, and the changes will automatically be reflected on all pages.

<% Dim DailyHoroscope Application("DailyHoroscope")="Good day filled with happiness. All commitments and financial transactions need to be handled carefully. A lack of communication with someone you care will leave you depressed. tree in autumn. If travelling make sure you carry all-important documents. " Response.write(Application("DailyHoroscope")) %>


ASP Session Object:

Session Object: The Session object stores information about a user. session is logicaly objects to preserve data accross subsequence HTTP request.
<% Session("username")="Deepak madheshiya" Session("age")=24 %>

Friday, February 24, 2012

Checking for Browser Support HTML 5

Checking for Browser Support

Before you use the canvas element, make sure there is support in the browser or not. Using this way, you can provide some alternate text in case there is no support in their antique browser.
Example:
try {
document.createElement("canvasId").getContext("2d");
document.getElementById("browsersupport").innerHTML =
"Wow… HTML5 Canvas is supported in your browser.";
} catch (e) {
document.getElementById("browsersupport ").innerHTML = "Sorry… HTML5 Canvas is not supported
in your browser.";
}

In this example, you try to create a canvas object and access its context. If there is an error, you will
catch it and know that Canvas is not supported. A previously defined support element on the page is
updated with a suitable message to reflect whether there is browser support or not.
This test will indicate whether the canvas element itself is supported by the browser. It will not
indicate which capabilities of the Canvas are supported. At the time of this writing, the API is stable and
well-supported, so this should generally not be an issue to worry about.