Web Hosting Talk







View Full Version : What is the the Hashcode ?


Lunar-Gang
04-19-2010, 06:41 PM
When programming web applications we deal with HTML elements classes. Among their properties I noticed a property called "Hashcode". The value of this property looks like a global uniqe verifier. What is this property exactly and when do we use it ?

mattle
04-19-2010, 09:15 PM
Who's we? I don't. I usually template my HTML in XML files and then manipulate them using standardized XML classes if needed. If this is some sort of built-in or third party class, you're going to have to give us a tiny bit of information about the language you're using and the class if you want any help! For all we know, this HTML class is something some dude wrote way back when.

tim2718281
04-19-2010, 09:41 PM
If this is some sort of built-in or third party class, you're going to have to give us a tiny bit of information about the language you're using and the class if you want any help!

Java has a hashtable class which includes a hashcode method. It's not specific to HTML.

In a sense, it's a way to create content-addressable memory - the time taken to retrieve an item is independent of the number of items stored.

You wouldn't normally use that kind of thing for storing data in RAM in a scripting language with content-addressable memory.

Lunar-Gang
04-19-2010, 10:10 PM
In a sense, it's a way to create content-addressable memory -

Hashcode is a property of HTML Elements supported by .NET
Please notice that this hashcode could change every instance of the class, it's not a method, it's a read only property taking randome values assigned by the system. Like you said : it's a way to create content-addressable memory - and it's not used normally in programming.

vrahul11
04-19-2010, 11:48 PM
hashcode is used to generate unique value. Can used for caching purposes
http://en.wikipedia.org/wiki/Hash_function

tim2718281
04-20-2010, 02:26 AM
hashcode is used to generate unique value.

It's very unusual to create unique values for hashcodes. It *can* be done, but the algorithm would have to be created whenever the set of objects is changed.

So you might use unique hashcodes for something like keywords in a programming language.

The usual way to use hashcodes is to have a hashing method that generates non-unique values, and then deal with collisions.

madlymasterful2018
04-20-2010, 07:16 AM
These are nothing but codes used in HTML say for colors and they are the property of these colors.

How they are derived is not known..

tim2718281
04-20-2010, 07:37 AM
These are nothing but codes used in HTML say for colors and they are the property of these colors.


Are you referring to specifying colours in RGB by giving a hexadecimal value?

#804020 species the red intensity as #80 (50%), green as #40 (25%), blue as #20 (12.5%)

I didn't realise some people call that a hash code; though I can see why, now you mention it. Thanks for the info.

mattle
04-20-2010, 08:10 AM
Without the actual class name, it's kinda hard to tell. MSDN should have the documentation on all the class members, though.

Eddiewilson
05-01-2010, 12:06 AM
Hi Everyone,

A hash function is any well-defined procedure or mathematical function that converts a large, possibly variable-sized amount of data into a small datum.. Work like pointer but differ from pointer in C..

Thanks
Eddie wilson

nhnn
05-01-2010, 06:17 AM
duh!! the hash code is 420...
I kid I kid

johndept1
05-04-2010, 03:02 AM
http://isagoksu.com/2009/development/java/what-is-hash-code/
check this link

smithshn
05-05-2010, 12:17 PM
There is a different type of Hash Table.
In Java Hash-table class which includes a hash-code method.
While in HTML it elements along with classes related with its properties which is globally used.
Usually template of HTML in XML files and then manipulate them using standardised XML classes if required.

antonclovelly
05-06-2010, 12:18 AM
Objects in Java have hash codes associated with them. An object's hash code is a signed number that identifies the object for example, an instance of parent class. An object's hash code may be obtained by using the object's hashCode () method as follows:
int hashCode = SomeObject.hashCode ();
The method hashCode () is defined in the Object class and is inherited by all Java objects.

scroozlewis
05-24-2010, 11:03 PM
The hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. In Java, object is associated with hash code. Hash Code is a signed number that identifies the object. It returns the hash code of the invoking object. The hash code value returned by this method is a number of type int

georgelussie
05-29-2010, 04:30 AM
The hashCode () method is defined in java.lang.Object class. It returns hash code of invoking object. The hash code value returned by this technique is a number of type int. The signature of hashCode () method is given below:
public int hashCode ()

rentpbx
05-29-2010, 05:24 PM
Just want to make sure that I add that hash do not guarantee to produced unique number. Some Hash function maybe superior than other to avoid collision. Therefore, be careful to use it for its uniqueness. Check wikipedia about MD5 has for example.

saviourdlima
06-01-2010, 12:19 AM
Hash code is not an unique number for an object.If two objects are equals(means ob1.equals(ob2))then these two objects return same hash code.so we have to implement hashcode() of a class in such way that if two objects are equals(that is compared by equal() of that class)then those two objects must return same hash code.

revardwatson
06-16-2010, 12:23 AM
An object's hash code may be obtained by using the object's hashCode () method as int hashCode = SomeObject.hashCode ();
The method hashCode () is defined in Object class and is inherited by all Java objects.

stevetorres
06-23-2010, 04:02 AM
Not specified to HTML, including a hashcode method, Java has a hashtable class. In order to create memory that is content-addressable, this can be utilized.

josaphlewis
06-29-2010, 12:11 AM
Hash code is not an exceptional number for an object. If two substance are generation then these two objects return same hash code, so we have to execute hashcode() of a class in such way that if two objects are equals then those two objects must return same hash code.

dizile
06-29-2010, 02:44 AM
Hi lunar-gang,
Nice Post about Hashcode.
Really i need information of Hashcode.
Thanks for Great Sharing.