uniqueidentifier

Unique identifier for user profiles in Windows

别来无恙 提交于 2019-12-09 07:16:18
问题 For a client/server application I need to centrally store parts of the configuration information that usually goes into the users profile directory. The client application would on first use write a file or registry entry with a GUID into the current profile. This GUID would subsequently be used as a key in the configuration database on the server. Now I'm wondering if Windows user profiles already have unique identifiers I could use instead of generating my own GUIDs. The username won't work

How to define an APDU for STORE DATA for Host Card Emulation?

一笑奈何 提交于 2019-12-08 18:56:32
I have been looking in the Global Platform Spec on how to define an APDU for my app which will use Host Card Emulation (HCE). My app is supposed to have one phone behaving like an NFC tag through HCE and another phone acting as the NFC reader. The arbitrary data that i am trying to transfer between the phones is just a simple string containing an ID number, but I'm not really sure how to apply it in the code. I have looked at what the different byte commands mean but I'm really not sure how to apply it. I think I need to use the STORE DATA command but I'm not sure how to intuitively do it and

Passing uniqueidentifier parameter to Stored Procedure

风流意气都作罢 提交于 2019-12-08 17:28:40
问题 I am trying to pass a uniqueidentifier parameter to a stored procedure using the following code: myCommand.Parameters.Add("@BlogID", SqlDbType.UniqueIdentifier).Value = "96d5b379-7e1d-4dac-a6ba-1e50db561b04"; I keep getting an error however saying that the program was unable to convert from string to GUID. Am I passing the value incorrectly? 回答1: Try this myCommand.Parameters.Add("@BlogID", SqlDbType.UniqueIdentifier).Value = new Guid("96d5b379-7e1d-4dac-a6ba-1e50db561b04"); 回答2: A unique

Different casting of int to guid in C# and SQL Server

拜拜、爱过 提交于 2019-12-08 15:06:58
问题 When converting int to guid in C# and SQL Server I get different values. In C# I use this method public static Guid Int2Guid( int value ) { byte[] bytes = new byte[16]; BitConverter.GetBytes( value ).CopyTo( bytes, 0 ); return new Guid( bytes ); } Console.Write( Int2Guid( 1000 ).ToString() ); // writes 000003e8-0000-0000-0000-000000000000 In SQL Server I use select cast(cast(1000 as varbinary(16)) as uniqueidentifier) -- writes E8030000-0000-0000-0000-000000000000 Why would they behave

Reversibly encode two large integers of different bit lengths into one integer

强颜欢笑 提交于 2019-12-08 15:02:53
问题 I want to encode two large integers of possibly different maximum bit lengths into a single integer. The first integer is signed (can be negative) whereas the second is unsigned (always non-negative). If the bit lengths are m and n respectively, the bit length of the returned integer should be less than or equal to m + n . Just n (but not m ) is known in advance and is fixed. The solution will as an example be used to combine a signed nanosecond timestamp of 61+ bits along with 256 bits of

12 Digit Unique ID - Code reliability

妖精的绣舞 提交于 2019-12-08 12:15:11
问题 I wanted a number that would remain unique for a day (24 hours). Following is the code that I came up with; I was wondering about its fallacies/possible risks; 'I believe' this guarantees a 12 digit unique number for a day atleast. Logic is to get the current date/time (hhmmssmmm) and concat the first four bytes of query performance counter result. __forceinline bool GetUniqueID(char caUID[MAX_STRING_LENGTH]) { //Logic: Add HHMMSSmmm with mid 3 bytes of performance counter. //Guarantees that

How to define an APDU for STORE DATA for Host Card Emulation?

梦想与她 提交于 2019-12-08 04:52:40
问题 I have been looking in the Global Platform Spec on how to define an APDU for my app which will use Host Card Emulation (HCE). My app is supposed to have one phone behaving like an NFC tag through HCE and another phone acting as the NFC reader. The arbitrary data that i am trying to transfer between the phones is just a simple string containing an ID number, but I'm not really sure how to apply it in the code. I have looked at what the different byte commands mean but I'm really not sure how

How to generate unique URL variables that match to a db record?

和自甴很熟 提交于 2019-12-08 01:59:49
问题 I wish to be able to generate URL variables like this: http://example.com/195yq http://example.com/195yp http://example.com/195yg http://example.com/195yf The variables will match to a MySQL record set so that I can pull it out. At the time of creation of that record set, I wish to create this key for it. How can I do this? What is the best way to do this? Are there any existing classes that I can make use of? Thanks all 回答1: Basically, you need a hash function of some sort. This can be SHA-1

Custom string as Primary Key with Entity Framework

女生的网名这么多〃 提交于 2019-12-07 17:55:00
问题 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

iPhone UUID change when App Updated?

点点圈 提交于 2019-12-07 11:07:17
问题 I use iphone UUID for checking user's device is unique. I already know UUID will be changed when reinstall app. But, I have a question. Then, when app updated, UUID for my app will be changed? If UUID changed when app updated, where can I save UUID in iphone permanently(or same effect)? 回答1: Save out your created UUID into user preferences for the app, which should be backed up - if they restore the app from a backup you'll get back the UUID. If you want to be even more sure you can get back