uniqueidentifier

Formulas to generate a unique id?

℡╲_俬逩灬. 提交于 2019-12-01 22:42:37
I would like to get a few ideas on generating unique id's without using the GUID. Preferably i would like the unique value to be of type int32. I'm looking for something that can be used for database primary key as well as being url friendly. Can these considered Unique? (int)DateTime.Now.Ticks (int)DateTime.Now * RandomNumber Any other ideas? Thanks EDIT: Well i am trying to practise Domain Driven Design and all my entities need to have a ID upon creation to be valid. I could in theory call into the DB to get an auto incremented number but would rather steer clear of this as DB related stuff

Get last inserted UNIQUEIDENTIFIER in SQL Server 2000

白昼怎懂夜的黑 提交于 2019-12-01 17:02:47
The OUTPUT clause is compatible with SQL Server 2005 but not SQL Server 2000. How do I convert this command to work in SQL Server 2000? CREATE TABLE sample ( ID uniqueidentifier NOT NULL DEFAULT newid(), Title varchar(30) NOT NULL ) INSERT INTO sample (Title) OUTPUT INSERTED.ID VALUES ('Test1') I need the command to retrieve the ID since the INSERT command needs to be called from a stored procedure. Thanks for any help! DECLARE @uid uniqueidentifier SET @uid = newid() INSERT INTO sample (ID, Title) VALUES (@uid,'Test1') SELECT @uid AS ID 来源: https://stackoverflow.com/questions/5863168/get-last

Generating unique ids with the max length of 3 digits/letters/simbols

只谈情不闲聊 提交于 2019-12-01 14:50:59
I have a list of 75200 words. I need to give a 'unique' id to each word, and the length of each id could be 3 letters or less. I can use numbers, letters or even symbols but the max length is 3. Below is my code. import java.io.*; import java.util.*; public class HashCreator { private Map completedWordMap; private String [] simpleLetters = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}; private String[] symbols = {"!","@","#","$","%","^","&","*","~","?"}; private String indexNumber; String currentlyUsingLetter, currentlyUsingSymbol;

Auto-incrementing IDs for Class Instances

孤街浪徒 提交于 2019-12-01 12:12:22
Disclaimer : This is for a semester project that I am currently working on. My question is regarding an implementation level detail and is not part of the grading scheme. I am only writing this code as a way to test the theory that I am proposing for the paper that I will write. Also, I have considered the answers for this question with little luck, so please do not consider this as a duplicate of that question The Problem : I have a graph (G=(V,E)). At some point in my algorithm, I need to turn this into a hypergraph (in a sense) by "collapsing" multiple nodes (say, v_1, v_2, ..., v_n ) into

Can I create a new column based on when the value changes in another column?

孤者浪人 提交于 2019-12-01 08:26:29
Let s say I have this df print(df) DATE_TIME A B 0 10/08/2016 12:04:56 1 5 1 10/08/2016 12:04:58 1 6 2 10/08/2016 12:04:59 2 3 3 10/08/2016 12:05:00 2 2 4 10/08/2016 12:05:01 3 4 5 10/08/2016 12:05:02 3 6 6 10/08/2016 12:05:03 1 3 7 10/08/2016 12:05:04 1 2 8 10/08/2016 12:05:05 2 4 9 10/08/2016 12:05:06 2 6 10 10/08/2016 12:05:07 3 4 11 10/08/2016 12:05:08 3 2 The values in column ['A'] repeat over time, I need a column though, where they have a new ID each time they change, so that I would have something like the following df print(df) DATE_TIME A B C 0 10/08/2016 12:04:56 1 5 1 1 10/08/2016

Persistent UDID equivalent for iOS 7? [duplicate]

倖福魔咒の 提交于 2019-12-01 07:36:35
This question already has an answer here: UIDevice uniqueIdentifier deprecated - What to do now? 32 answers iOS unique user identifier [duplicate] 7 answers First of all, I'd like to say that I'm fully aware that uniqueIdentifier has been deprecated and there are identifierForVendor & advertisingIdentifier . My question is, if there is a way to have a fully persistent device identifier which lives through anything like reboots, app uninstalls, etc. Currently we use identifierForVendor which is OK - but one of our product's main requirements is to allow quick login without any registration, and

Can I create a new column based on when the value changes in another column?

荒凉一梦 提交于 2019-12-01 07:21:14
问题 Let s say I have this df print(df) DATE_TIME A B 0 10/08/2016 12:04:56 1 5 1 10/08/2016 12:04:58 1 6 2 10/08/2016 12:04:59 2 3 3 10/08/2016 12:05:00 2 2 4 10/08/2016 12:05:01 3 4 5 10/08/2016 12:05:02 3 6 6 10/08/2016 12:05:03 1 3 7 10/08/2016 12:05:04 1 2 8 10/08/2016 12:05:05 2 4 9 10/08/2016 12:05:06 2 6 10 10/08/2016 12:05:07 3 4 11 10/08/2016 12:05:08 3 2 The values in column ['A'] repeat over time, I need a column though, where they have a new ID each time they change, so that I would

Git repository unique id

倾然丶 夕夏残阳落幕 提交于 2019-12-01 05:43:40
I need to find out if a commit belongs to a particular git repository. The idea is to generate some unique id for every repository I need to test. Then I can compare this unique id to the id, calculated from tested commit. For example take an SHA of initial change set. Can it uniqely identify the repository? The SHA1 key is about identifying the content (of a blob, or of a tree), not about a repository. If the content differ from repo to repo, then its history has no common ancestor, so I don't think a change-set-based solution will work. Maybe (not tested) you could add some marker (without

Excel 2007 - Generate unique ID based on text?

谁说我不能喝 提交于 2019-12-01 04:15:47
I have a sheet with a list of names in Column B and an ID column in A. I was wondering if there is some kind of formula that can take the value in column B of that row and generate some kind of ID based on the text? Each name is also unique and is never repeated in any way. It would be best if I didn't have to use VBA really. But if I have to, so be it. Solution Without VBA. Logic based on First 8 characters + number of character in a cell. = CODE(cell) which returns Code number for first letter = CODE(MID(cell,2,1)) returns Code number for second letter = IFERROR(CODE(MID(cell,9,1)) If 9th

How is a guid actually stored and sorted/compared in SQL Server?

坚强是说给别人听的谎言 提交于 2019-12-01 03:13:39
问题 Say I have this guid: {2A87E3E2-2B6A-4149-9F5A-1B76092843D9} Does it actually store this an an alpha numeric in the database? (I don't think so cause it has to fit in 16 bytes.) If it does not, then how is it stored? (My guess is as a hex number, but I am not sure.) How can you tell if one GUID is greater than another? (Which you may need to know for indexing purposes.) Do you read the GUID just like a hex number (for comparison)? 回答1: A GUID is stored as binary(16) internally. "Using