All Questions

340
votes
10answers
43170 views

"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 = 2...
47
votes
6answers
119927 views

SQL Server, How to set auto increment after creating a table without data loss?

I have a table table1 in SQL server 2008 and it has records in it. I want the primary key table1_Sno column to be an auto-incrementing column. Can this be done without any data transfer or cloning ...
90
votes
9answers
63447 views

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 t...
97
votes
4answers
66278 views

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 ...
239
votes
17answers
62960 views

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 lik...
21
votes
4answers
1211 views

Why does id({}) == id({}) and id([]) == id([]) in CPython?

Why does CPython (no clue about other Python implementations) have the following behavior? tuple1 = () tuple2 = () ...
41
votes
2answers
1117 views

'is' operator behaves unexpectedly with non-cached integers

When playing around with the Python interpreter, I stumbled upon this conflicting case regarding the is operator: If the evaluation takes place in the function it returns True, if it is done outside...
152
votes
13answers
298515 views

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 autoincremented value. Now I would li...
191
votes
8answers
207184 views

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

I have Article entity in my project which have ApplicationUser property named Author. How can I get full object of currently logged ApplicationUser. While creating new article I have to set Author pro...
180
votes
9answers
149315 views

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, ...

Previous Next