Search

Mar 20, 2007

Playing with location of window in javascript

I found some properties and method which is really usefull while working with window location

· Properties

window.location.hashthe part of the URL that follows the # symbol.
window.location.hostthe host name and port number
window.location.hostnamethe host name (without the port number).
window.location.hrefThe entire URL
window.location.pathnameThe path (relative to the host).
window.location.portThe port number of the URL
window.location.protocolThe protocol of the URL
window.location.searchthe part of the URL that that follows the ? symbol


· Methods
assign(url)Load the document at the provided URL.
reload(forceget)Reload the document from the current URL. forceget is a boolean, which, when it is true, causes the page to always be reloaded from the server. If it is false or not specified, the browser may reload the page from its cache.
replace(url)Replace the current document with the one at the provided URL. The difference from the assign() method is that after using replace() the current page will not be saved in session history, meaning the user won't be able to use the Back button to navigate to it.
toString()
Returns the string representation of the Location object's URL. See the JavaScript
reference for details.


I have delicious on JavaScript

Mar 2, 2007

Overload property in .NET

Hello Friends,

I have new information to .NET programmers.
We can create or rather I say we can overload the property in VB.NET and C#
But there is a very vast difference in both languages

· VB.NET

Private ReadOnly Property MA() As String
Get
...
End Get
End Property

Private ReadOnly Property MA(ByVal movAvg As String) As String
Get
...
End Get
End Property


Ohh this is working like function overloading! But still its property!

· C#

public string Author
{
set {_author = value;}
get {return _author;}
}

public AuthorEntity Author
{
set {_authorEntity = value;}
get {return _authorEntity;}
}

You will be attempting to overload a function which differs only by return type, and it won't compile. this is why properties can't be overloaded in the way you want - because they are converted to get functions which would only differ by return type.

You can see the difference in both language. And its working!!!