Questions tagged [identity]

An inherent property of an entity that distinguishes that entity from all others. Frequently used to refer to user identity and authentication.

Identity typically refers to user identity in authentication scenarios.

2658 questions
1220
votes
15 answers

Why does comparing strings using either '==' or 'is' sometimes produce a different result?

I've got a Python program where two variables are set to the value 'public'. In a conditional expression I have the comparison var1 is var2 which fails, but if I change it to var1 == var2 it returns True. Now if I open my Python interpreter and do…
jottos
  • 19,028
  • 9
  • 28
  • 26
680
votes
23 answers

What is the difference between == and equals() in Java?

I wanted to clarify if I understand this correctly: == is a reference comparison, i.e. both objects point to the same memory location .equals() evaluates to the comparison of values in the objects
brainydexter
  • 17,648
  • 25
  • 70
  • 108
554
votes
11 answers

"is" operator behaves unexpectedly with integers

Why does the following behave unexpectedly in Python? >>> a = 256 >>> b = 256 >>> a is b True # This is an expected result >>> a = 257 >>> b = 257 >>> a is b False # What happened here? Why is this False? >>> 257 is 257 True …
Greg Hewgill
  • 828,234
  • 170
  • 1,097
  • 1,237
493
votes
11 answers

Auto increment primary key in SQL Server Management Studio 2012

How do I auto increment the primary key in a SQL Server database table, I've had a look through the forum but can't see how. I've looked the the properties but can't see an option, I have seen an answer where you go to the Identity specification…
Ledgemonkey
  • 6,285
  • 11
  • 32
  • 56
337
votes
19 answers

The JPA hashCode() / equals() dilemma

There have been some discussions here about JPA entities and which hashCode()/equals() implementation should be used for JPA entity classes. Most (if not all) of them depend on Hibernate, but I'd like to discuss them JPA-implementation-neutrally (I…
MRalwasser
  • 14,580
  • 14
  • 95
  • 134
253
votes
10 answers

How to get the unique ID of an object which overrides hashCode()?

When a class in Java doesn't override hashCode(), printing an instance of this class gives a nice unique number. The Javadoc of Object says about hashCode(): As much as is reasonably practical, the hashCode method defined by class Object does…
ivan_ivanovich_ivanoff
  • 18,003
  • 24
  • 78
  • 100
244
votes
10 answers

ASP.NET MVC 5 - Identity. How to get current ApplicationUser

I have an Article entity in my project which has the ApplicationUser property named Author. How can I get the full object of currently logged ApplicationUser? While creating a new article, I have to set the Author property in Article to the current…
Ellbar
  • 3,743
  • 6
  • 19
  • 31
217
votes
7 answers

What is the difference between Scope_Identity(), Identity(), @@Identity, and Ident_Current()?

I know Scope_Identity(), Identity(), @@Identity, and Ident_Current() all get the value of the identity column, but I would love to know the difference. Part of the controversy I'm having is what do they mean by scope as applied to these functions…
Tebo
  • 13,615
  • 11
  • 49
  • 64
160
votes
13 answers

How to change identity column values programmatically?

I have a MS SQL 2005 database with a table Test with column ID. ID is an identity column. I have rows in this table and all of them have their corresponding ID auto incremented value. Now I would like to change every ID in this table like this: ID…
130
votes
3 answers

SQL Server 2012 column identity increment jumping from 6 to 1000+ on 7th entry

I have a strange scenario in which the auto identity int column in my SQL Server 2012 database is not incrementing properly. Say I have a table which uses an int auto identity as a primary key it is sporadically skipping increments, for…
Andy Clark
  • 3,133
  • 7
  • 24
  • 41
98
votes
5 answers

Generating human-readable/usable, short but unique IDs

Need to handle > 1000 but < 10000 new records per day Cannot use GUID/UUIDs, auto increment numbers etc. Ideally should be 5 or 6 chars long, can be alpha of course Would like to reuse existing, well-known algos, if available Anything out there ?
Kumar
  • 9,481
  • 10
  • 74
  • 126
87
votes
4 answers

How to insert into a table with just one IDENTITY column?

(Came up with this question in the course of trying to answer this other one) Consider the following MS-SQL table, called GroupTable: GroupID ------- 1 2 3 where GroupID is the primary key and is an Identity column. How do you insert a new…
codeulike
  • 20,946
  • 27
  • 113
  • 161
76
votes
4 answers

What is the purpose of the ConcurrencyStamp column in the AspNetUsers table in the new ASP.NET MVC 6 identity?

What is the purpose of the ConcurrencyStamp column in the AspNetUsers table in the new ASP.NET MVC 6 identity? This is the database schema of the AspNetUsers table: It is also there in the AspNetRoles table: As I remember it wasn't there in the…
74
votes
6 answers

Programmatically get a Storyboard ID?

Trying to see if a UIViewController or UIView can identify its Storyboard ID. So was hoping for: UIViewController *aViewController; NSString *storyboardID = aViewController.storyboard.id; //not an actual property or: NSString *storyboardID =…
Jalakoo
  • 3,073
  • 2
  • 18
  • 18
69
votes
4 answers

How to generate unique id in Dart

I write websocket chat. How to generate unique id for user? now i use this code: id = new DateTime.now().millisecondsSinceEpoch; is there any more neat solution?
Sergey Karasev
  • 3,243
  • 2
  • 21
  • 24
1
2 3
99 100