How to generate unique id in Dart

1. There is a UUID pub package: http://pub.dartlang.org/packages/uuid example usage: import ‘package:uuid/uuid.dart’; // Create uuid object var uuid = Uuid(); // Generate a v1 (time-based) id uuid.v1(); // -> ‘6c84fb90-12c4-11e1-840d-7b25c5ee775a’ // Generate a v4 (random) id uuid.v4(); // -> ‘110ec58a-a0f2-4ac4-8393-c866d813b8d1’ // Generate a v5 (namespace-name-sha1-based) id uuid.v5(uuid.NAMESPACE_URL, ‘www.google.com’); // -> ‘c74a196f-f19d-5ea9-bffd-a2742432fc9c’ 2. This src has … Read more

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

This is all perfectly normal. Microsoft added sequences in SQL Server 2012, finally, i might add and changed the way identity keys are generated. Have a look here for some explanation. If you want to have the old behaviour, you can: use trace flag 272 – this will cause a log record to be generated … Read more

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

The @@identity function returns the last identity created in the same session. The scope_identity() function returns the last identity created in the same session and the same scope. The ident_current(name) returns the last identity created for a specific table or view in any session. The identity() function is not used to get an identity, it’s … Read more

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

You should not need to query the database directly for the current ApplicationUser. That introduces a new dependency of having an extra context for starters, but going forward the user database tables change (3 times in the past 2 years) but the API is consistent. For example the users table is now called AspNetUsers in … Read more

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

System.identityHashCode(yourObject) will give the ‘original’ hash code of yourObject as an integer. Uniqueness isn’t necessarily guaranteed. The Sun JVM implementation will give you a value which is related to the original memory address for this object, but that’s an implementation detail and you shouldn’t rely on it. EDIT: Answer modified following Tom’s comment below re. … Read more

The JPA hashCode() / equals() dilemma

Read this very nice article on the subject: Don’t Let Hibernate Steal Your Identity. The conclusion of the article goes like this: Object identity is deceptively hard to implement correctly when objects are persisted to a database. However, the problems stem entirely from allowing objects to exist without an id before they are saved. We … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)