uniqueidentifier

Using new Date() as unique identifier

爱⌒轻易说出口 提交于 2019-12-07 08:02:42
问题 Imagine i have a proccess that creates 1000 entities each second. for each of these entities i call the setter : newEntity.setDate(new Date()); 1) Is it possible that 2 entities will recieve the same date? or is it safe to assume that i do get a unique identifier effect for the date field? 2) If the answer to question #1 is :"yes" - let's make a minor tweak: lets create a function: public static synchronized Date getDate() { return new Date(); } will it work now? newEntity.setDate(getDate());

NFC Tag as authentication tool

孤人 提交于 2019-12-06 12:36:57
Can I use NFC tag as authentication tool, for example when the tag is tapped, it opens a url, connects to a remote database and checks if that is the original Tag and returns true or false. The information and the url will be public so anyone can tap the tag, but if someone copy its content to another tag, then it connects to the database it will return false. So actually that would be a public tag but with an unique identificator that can't be copied. Hope it makes sense, im new to the NFC tags but i find them quite exciting. An NFC tag (as defined by the NFC Forum's Tag Operation

MySQL UUID() when not unique?

China☆狼群 提交于 2019-12-06 11:04:53
问题 What happens when a UUID() generated by MySQL is not unique? If this is for a column that is a primary key, does MySQL error out, or does it try generating another UUID until a truly unique one is found? 回答1: Well, if you call UUID() twice and get the same results, the most problematic thing would be that "stuff is broken" (tm). It's supposed to be unique and it should be always, as far as I know. There would be no "regenerate" code available: the function is designed to create unique keys

Matlab class with knowledge of instance name in the constructor

。_饼干妹妹 提交于 2019-12-06 10:46:46
I would like to have a class which, in its constructor, can have knowledge (extract as a string) its instance name. For the moment I worked the name extraction out like this: classdef mysession methods (Access = public) function this=mysession (varargin) this.cargs=varargin; this.built=false; end function id=build(this) id=this.mynameis; this.id = id; %% instructions needing id built=true; end function name = mynameis (this) name=evalin ('caller', 'inputname'); end end properties (Access=private) id built cargs end end which requires the ugly A = mysession; A.build syntax in order to work...

Sql Server: uniqueidentifier plus integer compound PK … what type of index to use?

不问归期 提交于 2019-12-06 07:41:48
I have a junction table in my SQL Server 2005 database that consist of two columns: object_id (uniqueidentifier) property_id (integer) These values together make a compound primary key. What's the best way to create this PK index for SELECT performance? If the columns were two integers, I would just use a compound clustered index (the default). However, I've heard bad things about clustered indexes when uniqueidentifiers are involved. Anyone have experience with this situation? Yes, GUID's are really bad for clustered indexes, since the GUIDs is by design very random and thus leads to massive

Clustered/non-clustered index on unique identifier column in SQL Server

浪子不回头ぞ 提交于 2019-12-06 04:05:57
问题 I have read the various questions/answers here that basically indicate that having a clustered index on a uniqueidentifier column is a poor choice for performance reasons. Regardless, I need to use a uniqueidentifier as my primary key, and I do NOT want to use newsequentialid() because the generated values are too similar to one another (I need more random IDs so users can't [reasonably] 'guess' another ID). So, what is the best way to index this PK? Even though a clustered index on this

How to get unique machine signature without WMI?

百般思念 提交于 2019-12-06 03:42:50
I know that a question has already been asked about generating a unique ID for a machine but my question is slightly different. I want to know whether there are any other methods (API calls?) to get hardware information and NOT use WMI. I understand from MSDN that WMI is introduced in Win2000 so it doesnt seem to be available in Win98. I have an application that has to run even on Win98 (I know it sucks but what can you do?) and still get hold of hardware information. Robert Venables I've done this several times for licensing projects. For the hard drive serial number use: private static

Unique ID with time()

好久不见. 提交于 2019-12-06 03:33:43
问题 If I use: $t = time(); echo $t; This will output something like: 1319390934 I have two questions: This value can be used as unique id ? how to generate from it a date? I can't use uniqid() , because I need a value that can be used to order (recent). 回答1: Using time() as mentioned will give you a sortable way to create unique IDs. Concatenating strings will also further randomize your desired result and still keep it sortable: $uniqueId= time().'-'.mt_rand(); 回答2: Obviously this cannot be used

PL/pgSQL column name the same as variable

那年仲夏 提交于 2019-12-06 03:14:28
问题 I'm new to plpgsql and I'm trying to create function that will check if a certain value exists in table and if not will add a row. CREATE OR REPLACE FUNCTION hire( id_pracownika integer, imie character varying, nazwisko character varying, miasto character varying, pensja real) RETURNS TEXT AS $BODY$ DECLARE wynik TEXT; sprawdzenie INT; BEGIN sprawdzenie = id_pracownika; IF EXISTS (SELECT id_pracownika FROM pracownicy WHERE id_pracownika=sprawdzenie) THEN wynik = "JUZ ISTNIEJE"; RETURN wynik;

Custom string as Primary Key with Entity Framework

怎甘沉沦 提交于 2019-12-06 02:47:28
I'm trying to set a personalized string as Primary Key using Code First Entity Framework. I have a helper with a function that returns a n-chars random string, and I want to use it to define my Id, as for YouTube video code. using System.Security.Cryptography; namespace Networks.Helpers { public static string GenerateRandomString(int length = 12) { // return a random string } } I don't want to use auto-incremented integers (I don't want users using bots too easily to visit every item) nor Guid (too long to show to the users). using Networks.Helpers; using System; using System.ComponentModel