FAQ Database Discussion Community

Object not showing in DetailView when using a uuid as primary key

I'm using this to generate my primary keys as I don't want them to be simple numbers easy to guess (found it in this post): def make_uuid(): return base64.b64encode(uuid.uuid4().bytes).replace('=', '') Here is my model: class Shipment(models.Model): trackid = models.CharField(max_length=36, primary_key=True, default=make_uuid, editable=False) How can I make my DetailView view work...

Check if std::string is a valid uuid using boost

I want to check if a given string is a valid UUID using boost. This is what I have come up with by looking at the documentation on the boost website: void validate_uuid(const std::string& value) { try { boost::uuids::string_generator stringGenerator; (void)stringGenerator(value); } catch (const std::exception& ex) { // ... }...

Get unique identifier of a system (not the MAC-address)?

for some reasons I need to get a unique identifier of a Linux system that does not change when the system is rebooted (but may change when the user replaces nameable amounts of the hardware or formats harddisk). Following solutions are NOT possible: use the MAC-address (this is already used...

Is there any way to generate the same UUID based on the seed string in JDK or some library?

I am wondering if there is a way to generate the same UUID based on the string. I tried with uuid class from JDK, it looks like it does not provide this feature.

How to generate UUID(Long) using cassandra timestamp in cluster environment?

I have the requirement where we need to generate UUID as Long value using Java based on Cassandra timestamp which is in cluster. Can anyone help how to geranate it using java and cassandra cluster timestamp combination?

How to create a 64 bit Unique Integer in Java?

I need to create a 64 bit Unique Integer in Java so that collision chances are pretty less. Is there any way, we can create a 64 bit integer in Java which is always Unique? As of now I am using - long number = System.nanoTime(); Is this the right...

Java - Is it safe to do deepCopy of UUID field as this.uuid = original.getUUID()?

For the following class, when I do deep copy, is it safe to write code as this.id = original.getId(); In my test, it seems OK, as when I want to update the UUID field, I always assign it with a new UUID instance(I couldn't find any function which can modify...

How deploy an large number iBeacons

I want deploy a large number of iBeacons with the same UUID because we can't access dynamically to the UUID of the beacons detected. What is the limit number of the maximum Beacons with the same UUID ? I found some discussions with a number of 65000 approximately, is it...

Inserting and selecting UUIDs as binary(16)

I don't understand why SELECT UUID(); Returns something like: 3f06af63-a93c-11e4-9797-00505690773f But if I insert it into a binary(16) field (the UUID() function) with for instance a BEFORE INSERT trigger and run a select, it returns something like: 0782ef48-a439-11 Note that these two UUIDs are not the same data. I realize...

Ruby on Rails 4.2 with Globalize gem for UUID table

I use Globalize gem for my rails 4.2 project, and the table primary ID is UUID in postgre. Here is the table migration codes and created translation table foreign key is integer type, not UUID. class CreateMessageThreads < ActiveRecord::Migration def up enable_extension 'uuid-ossp' create_table :message_threads, id: :uuid do |t| t.integer...

Transform CBPeripheral's UUID to string format :

I am trying to transform a CBPeripheral's UUID to string format: CBPeripheral* peripheral; NSString *pUuid = (__bridge NSString *)(CFUUIDCreateString(nil, peripheral.UUID)); but i got this error: Incompatible pointer types passing retainable parameter of type 'NSString *' to a CF functions expecting 'CFUUIDRef' (aka 'const struct _CFUUID *') type ...

Portable UUID on Linux

On Windows and MacOSX it is trivial to retrieve some kind of UUID per machine: On Windows (regedit): "Software\Microsoft\Cryptography\MachineGuid" On MacOSX $ ioreg -rd1 -c IOPlatformExpertDevice | grep IOPlatformUUID However on Linux this is much more complex. So far I have found the following: On dbus based system: $ cat...

Python How to Create UUID Based on File Contents

I was looking at the documentation and in the example section, I don't see how to create a UUID based on File Contents. Google did not help me either. I've tried this: >>> import uuid >>> data = open('/media/emmc/DCIM/100ABC06/00059.JPG','rb') >>> contents = data.read() >>> len(contents) 9155 >>> uuid = uuid.UUID(contents)...

cast uuid to varchar in postgres when I use sequelize

I have a table with a column named _id of which the type is uuid. I cast the type of _id from uuid to varchar, in order to select the records as follows: SELECT "_id" FROM "records" WHERE "_id"::"varchar" LIKE '%1010%'; and it works well. _id -------------------------------------- 9a7a36d0-1010-11e5-a475-33082a4698d6 (1 row)...

Convert Two Longs to a Hex String

I have two longs representing the most and least significant bytes of a UUID respectively. How can I use Ruby to convert these two longs into a 32-character hex representation?

Ruby on Rails - Implementing UUID as Primary Key With Existing Schema

Currently I am creating a RESTful API for a mobile application. The RESTful API has a number of end points that allow users to exchange personal information between each other. I was testing how secure these endpoints were and quickly realized that if a third party managed to gain access...

how to create random UUID in andriod when button click event happens?

I am a beginner to Android. I want to create random UUID and store to database as a primary key. I am using UUID.randomUUID.toString() this code in Button click event. The UUID has been successfully created for the first time. But if I click the button again, I want to...

Is it safe (in matter of uniqueness) to use UUID to generate a unique identifier for specific string?

String myText; UUID.nameUUIDFromBytes((myText).getBytes()).toString(); I am using above code to generate a representative for specific texts. For example 'Moien' should always be represeted with "e9cad067-56f3-3ea9-98d2-26e25778c48f", not any changes like project rebuild should be able to change that UUID. The reason why I'm doing this is so that I don't want those...

How do I order dict by iterating list of uuids in django template language?

I'm trying to order a dict by using a list containing the order uuids in django - how would I template this out? order = ['uuid1', 'uuid2'] data = { u'uuid1': { u'checked': False, u'deleted': False, u'last_change': u'2014-12-25 09:15:22.155000', u'text': u'Test.' }, u'uuid2': { u'checked': False, u'deleted': False, u'last_change': u'2014-12-25...

Bluetooth Shield V2.2 for arduino

I recently bought a bluetooth shield for my arduino. I am going to make an iOS app that will control the servos that I will be connecting to the arduino. I feel stupid asking this because it is hard to find but where do I find the UUID for the...

rails server not starting on rails 3.1.2

I am using rails 3.2.1 with ruby 1.9.3 on ubuntu 13.10 with rbenv I hace everything good but when I try to start the server it gives an error anybody who know anything related to this please help. In a great need. => Booting WEBrick => Rails 4.2.0 application starting...

identifierForVendor changes on reinstall

identifierForVendor is not supposed to change on reinstall of app: The value in this property remains the same while the app (or another app from the same vendor) is installed on the iOS device. The value changes when the user deletes all of that vendor’s apps from the device and...

Verify a string as a valid UUID in Swift

Given an supplied String, how can I verify wether the String is a valid UUID in Swift? A valid UUID (as far as I know) could be: 33041937-05b2-464a-98ad-3910cbe0d09e 3304193705b2464a98ad3910cbe0d09e...

Unique Linux filename, sortable by time

Previously I was using uuidgen to create unique filenames that I then need to iterate over by date/time via a bash script. I've since found that simply looping over said files via 'ls -l' will not suffice because evidently I can only trust the OS to keep timestamp resolution in...

How to generate uuid which will be the same for each seed string?

I am wondering how to get the same uuid by using the same seed string. Any idea?

Making the most out of two 5-digit numbers

not sure if this is the right place, but I AM sure there are people amongst you who would be able to give me a good insight in the following: Consider this description of iBeacon's payload. As far as I understand there is one UUID that unifies a group of...

Autogenerate UUID or timeuuid in spring-data Cassandra?

I am using spring-data-cassandra. Is there a way or an annotation, which can be used in my entity java POJO for the primary key of type uuid or timeuuid,to auto-generate the value of the primary key(id)? I know that I can use id = UUIDs.timeBased();, but I want to automate...

MongoDB insert UUID only using middleware?

i dont know how to insert UUID into MongoDB properly. For example: db.users.insert({ uuid: UUID(buffer) }) Buffer must be 32 hex string and MongoDB natively dont create UUID, only stores this? I'm right? But where i create the random UUID, e.g through Node.js middleware i have a random UUID 11986aba-7c5a-4626-b354-80be23c25516,...

How to use uuid:randomUUID() in policy builder @Novell

I want to use predefined method of java using java.util.UUID:randomUUID() for 046b6c7f-0b8a-43b9-b35d-6489e6daee91 in place of CN, but when i use this code in my policy, then it gives me com\.novell\.xsl\.extensions\[email protected] in place of CN. So how can i solve this issue? Here is my Policy : <do-set-local-variable name="id1"> <arg-string> <token-xpath...