uniqueidentifier

Generating unique, hard-to-guess “coupon” codes

跟風遠走 提交于 2019-11-28 17:13:41
问题 My Rails app needs to generate electronic coupons for users. Each coupon given should have a unique coupon code that can be redeemed on our system. For example a coupon for a free burrito. User A receives a coupon for a free burrito and then User B receives a coupon for a free burrito. The 2 coupons should have unique coupon codes. What is the best way to generate a code like this that is not easily forged? I don't want users to have a high success rate of typing in random numbers and

.NET Short Unique Identifier

走远了吗. 提交于 2019-11-28 16:37:23
I need a unique identifier in .NET (cannot use GUID as it is too long for this case). Do people think that the algorithm used here is a good candidate or do you have any other suggestions? Dor Cohen This one a good one - http://www.singular.co.nz/blog/archive/2007/12/20/shortguid-a-shorter-and-url-friendly-guid-in-c-sharp.aspx and also here YouTube-like GUID You could use Base64: string base64Guid = Convert.ToBase64String(Guid.NewGuid().ToByteArray()); That generates a string like E1HKfn68Pkms5zsZsvKONw==. Since a GUID is always 128 bits, you can omit the == that you know will always be

How to obtain (almost) unique system identifier in a cross platform way?

纵饮孤独 提交于 2019-11-28 16:33:56
I'm looking for a way to get a number which will almost surely change when running the code on different machines and almost surely stay the same between two runs on the same machine. If I were doing this as a shell script in Linux, I would use something like this: { uname -n ; cat /proc/meminfo | head -n1 ; cat /proc/cpuinfo ; } | md5sum But I need this in C++ (with boost) and at least on Windows, Linux and Mac. Rafael Baptista To generate a mostly unique machine id, you can get a few serial numbers from various pieces of hardware on the system. Most processors will have a CPU serial number,

NSFileManager unique file names

筅森魡賤 提交于 2019-11-28 16:16:24
问题 I need a quick and easy way to store files with unique file names on iOS. I need to prefix the file with a string, and then append the generated unique identifier to the end. I was hoping NSFileManager had some convenient method to do this, but I can't seem to find it. I was looking at createFileAtPath:contents:attributes: , but am unsure if the attributes will give me that unique file name. 回答1: Create your own file name: CFUUIDRef uuid = CFUUIDCreate(NULL); CFStringRef uuidString =

Always get a unique device id in iOS 7

谁都会走 提交于 2019-11-28 16:06:23
Our iOS application is for specific users. So, we used device unique identifier for user identification. This approach works fine till iOS 6, because we are getting the same value every time. NSString *strUniqueIdentifier = [[UIDevice currentDevice] uniqueIdentifier]; In iOS 7, the above method is returning different values and we are getting issues in user identification. iOS 7 provides the following alternate . NSUUID *oNSUUID = [[UIDevice currentDevice] identifierForVendor]; [strApplicationUUID setString:[oNSUUID UUIDString]]; We replaced uniqueIdentifier with identifierForVendor , and

How to create a multi-select parameter with a uniqueidentifier?

佐手、 提交于 2019-11-28 12:53:36
I am developing an SSRS 2008 R2 RDL file. Now, I am trying to add a report parameter which should be a multi-select. Previously I have worked with multi-select parameters but they have always been CHARACTER data types before. So in my main dataset my code was: ;WITH Cte AS ( SELECT 1 as id, CAST('<M>' + REPLACE( (select @IncidentType), ',' , '</M><M>') + '</M>' AS XML) AS Names ) SELECT id, Split.a.value('.', 'VARCHAR(MAX)') AS Names INTO #incident_types FROM Cte CROSS APPLY Names.nodes('/M') Split(a) (And in my RDL file this IncidentType report parameter allows multiselect) But now

Unique computer ID hardware based in Java

和自甴很熟 提交于 2019-11-28 10:56:13
I need to generate a unique code from a single PC, my software will be distribute by licence, and locally I need to identify the environment and send this code to the server. I don't want to mantain on the server a sequencial number and each client recieve a number of the sequence, i tried to read the MAC adress from NetworkInterfaces, but is not secure, the user can change easily the MAC adress. The best way I think if its possible to read the motherboard serial number, but I haven't found the way until now. Any sugestion? How much is your software worth ? Does the target market pirate

A question regarding string instance uniqueness in python

筅森魡賤 提交于 2019-11-28 09:13:01
问题 I was trying to figure out which integers python only instantiates once (-6 to 256 it seems), and in the process stumbled on some string behaviour I can't see the pattern in. Sometimes, equal strings created in different ways share the same id, sometimes not. This code: A = "10000" B = "10000" C = "100" + "00" D = "%i"%10000 E = str(10000) F = str(10000) G = str(100) + "00" H = "0".join(("10","00")) for obj in (A,B,C,D,E,F,G,H): print obj, id(obj), obj is A prints: 10000 4959776 True 10000

Changing manually $(AppIdentifierPrefix) property?

喜欢而已 提交于 2019-11-28 08:44:58
问题 I had application uploaded on apple store. Now I am developing update version. But instead on working on existing project, i created new project with different name. When i finished i changed name and bundle identifier to match existing app. I tried uploading app to test flight but i got error "Invalid IPA: The keychain-access-group in the embedded.mobileprovision and your binary don't match." So I started browsing net for answers... What I have come up is to enable entitlements. I did, but

How to detect in Android whether UID from NFC tag is random?

吃可爱长大的小学妹 提交于 2019-11-28 06:34:12
问题 I am working on an Android project which relies on the unique UID of a discovered NFC tag to process the tag. I extract this UID using the following code: byte[] extraID = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID); However, for some technologies this UID is randomly generated for security purposes. Does anybody have an idea how I could detect that this is a randomly generated UID? Is there some kind of flag that is set? note: a simple solution would be to read the tag twice and compare