Menu
  • HOME
  • TAGS

What is the most efficient way to generate a UUID in PHP? [closed]

php,apache,uuid

I'd suggest that you profile the problem. The shell_exec() PHP function also spawns a shell, so it might not come as cheap as you think. However the PHP class you mention also seems to call subprocesses. I did some tests (on OS X) and could generate 10.000 UUIDs with the...

Python: UUID in a list

python,list,compare,uuid

You need to convert uuid to string with str() function . >>> import uuid >>> x=uuid.uuid4() >>> str(x) '924db46b-5c51-4330-861c-363570ea9ef6' and for check you need to convert string to uuid ,with uuid.UUID but as this function accept bytes you need to pass the bytes of your string to it : >>>...

Liferay FileEntry UUID Source

liferay,media,portlet,uuid,documents

You can check PortalUUIDImpl.java for the implementation

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

java,uuid

You can use UUID this way to get always the same UUID for your input String: String aString="JUST_A_TEST_STRING"; String result = UUID.nameUUIDFromBytes(aString.getBytes()).toString(); ...

Generate password reset token through UUID

java,base64,uuid

Using an UUID is safe and secure. The linked article just says that an UUID is maybe a little too much for this kind of security. But well ... if you are "too" secure, no one will blame you. An UUID is just alpha numeric characters and dashes. So...

Python: how to generate a unique identifier for an XML document?

python,xml,python-2.7,xslt-1.0,uuid

A colleague just sent me the answer: For mapping text to an ID, we’ve used MD5 as one hash digest. Give the md5() function an XML document (string) and it will return a 32-character identifier. More details: genid.py import sys import stdio from hashlib import md5 def digest_md5(obj): if type(obj)...

How can I convert a UUID from binary format to string format in Lua?

string,lua,uuid

string.format("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", string.byte(str,1,16)) ...

MySQL adding dashes to UUID in a table

mysql,uuid

SET @x = '5967ca5e6162317eb4a825dcdcde0aea'; SELECT CONCAT_WS('-',MID(@x,1,8),MID(@x,9,4),MID(@x,13,4),MID(@x,17,4),MID(@x,21,1000))n; +--------------------------------------+ | n | +--------------------------------------+ | 5967ca5e-6162-317e-b4a8-25dcdcde0aea | +--------------------------------------+ ...

Writing UUID to JSON in Scala with Spray

json,scala,uuid,spray

Make sure to have the implicit format for the Uuid before the user format that uses it and it should work: object UserJsonProtocol extends DefaultJsonProtocol { implicit object UuidJsonFormat extends RootJsonFormat[UUID] { def write(x: UUID) = JsString(x.toString) //Never execute this line def read(value: JsValue) = value match { case JsString(x)...

Is a UUID “URL safe”?

url,uuid

Yes. A UUID consists of only hexadecimal characters (a–f, 0–9) plus a hyphen (-). As per RFC 3986 §2.3, all of these are explicitly unreserved....

Unique string identifier with fixed length

java,algorithm,cryptography,uuid,uniqueidentifier

As others pointed out, it is not possible to generate a unique alphanumeric string with length 11 from each email address, as the alphanumeric strings with length 11 are less than all the possible email addresses. So there will always be two different email addresses e1 and e2 such that...

UUID ios for different apps

ios,objective-c,uuid

This is not possible because Apple sees this a breach of privacy.

cast uuid to varchar in postgres when I use sequelize

postgresql,uuid,sequelize.js

I write the query condition as follows, and it works well. Is there any better solution? {where: ['_id::"varchar" like ?', '%1010%']}, ...

Create big integer from the big end of a uuid in PostgreSQL

postgresql,database-design,types,casting,uuid

This is all very shaky, both the problem and the solution you describe in your self-answer. First, a mismatch between a database design and a third-party application is always possible, but usually indicative of a deeper problem. Why does your database use the uuid data type as a PK in...

How deploy an large number iBeacons

bluetooth,raspberry-pi,bluetooth-lowenergy,uuid,ibeacon

Bluetooth beacons (iBeacon and AltBeacon) have a three part identifier: ProximityUUID (16 bytes) Major (2 bytes) Minor (2 bytes) There are 8 bits per byte, so if you give all your beacons the same ProximityUUID, you can have 8*2*2=32 bits worth of combinations. That's 2^32 = 4,294,967,296 combinations. If you...

Python How to Create UUID Based on File Contents

python,python-2.7,guid,uuid

If you want to create a hash of a file content, you probably don't need UUID. Instead, you should use hashlib and MD5, SHA-1, SHA-256 or any other supported algorithm to create a fingerprint of your file.

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

java,uuid,deep-copy

Yes, it's safe. UUID is immutable. As you observed, you never modify the instance, you just assign a new instance to your member. So, you never effect any other code's UUID, even if they originally had a reference to the same one that you have. The 'copy' code is totally...

Verify a string as a valid UUID in Swift

swift,uuid

You could use NSUUID var uuid = NSUUID(UUIDString: yourString) This will return nil if yourString is not a valid UUID Note: this only validates the first case you presented, not the second but adding the dashes yourself is trivial....

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

java,android,uuid

First time it intialise the variable and next time when you click button it doesn't get null value Remove if condition from this if(uniqueId == null) { uniqueId = UUID.randomUUID().toString(); } Use this uniqueId = UUID.randomUUID().toString(); ...

iBeacons Transmit and Receive UUID

ios,uuid,core-bluetooth,ibeacon

The problem is that the UUID you read with CBCentralManager has nothing to do with the iBeacon's ProximityUUID. Despite the use of the term UUID in both fields, they are completely different. The field you can see with CBCentralManager is just a session-specific identifier generated by iOS. If you use...

Mysql Storing very large number of data : UUID as primary key vs any other logic [duplicate]

php,mysql,database,performance,uuid

Just use BIGINT UNSIGNED. An unsigned INT64 is something like 4.000.000.000 times 4.000.000.000. So assuming you have one device for each of the less than 8 billion people on the planet logging once per second, that leaves you with 2 billion seconds or more than 63 years. I assume, that...

How can I convert a UUID to base64?

java,encoding,base64,uuid

First, convert your UUID to a byte buffer for consumption by a Base64 encoder: ByteBuffer uuidBytes = ByteBuffer.wrap(new bytes[16]); uuidBytes.putLong(uuid.getMostSignificantBits()); uuidBytes.putLong(uuid.getLeastSignificantBits()); Then encode that using the encoder: byte[] encoded = encoder.encode(uuidBytes); Alternatively, you can get a Base64-encoded string like this: String encoded = encoder.encodeToString(uuidBytes); ...

MongoDB insert UUID only using middleware?

node.js,mongodb,buffer,uuid

BSON, hence MongoDB support the UUID type. From the Mongo Shell, you can use the UUID() constructor to convert from a 32 hex-digits string to an UUID internal representation. From node.js, using the node-uuid module you can easily generate v1 or v4 UUID and store them in a buffer object:...

EclipseLink's @UuidGenerator leads to NullPointerException

java,java-ee,eclipselink,uuid

It seems it's really EclipseLink's bug and it will hardly be fixed soon so I've used a work around - direct id generation as described here http://blog.xebia.com/2009/06/03/jpa-implementation-patterns-using-uuids-as-primary-keys/ @Id private String id; public AbstractBaseEntity() { this.id = UUID.randomUUID().toString(); } ...

Best field type to store PhoneGap's device.uuid in MySQL

android,mysql,ios,cordova,uuid

Since UUID ca vary in length from platform and device type, I suggest using either varchar or tinytext field type to store this data. Both are capable of handling the upper limit of these string lengths and wont add too much overhead to the database.

Unique Linux filename, sortable by time

bash,timestamp,uuid

If you order your date format by year, month (zero padded), day (zero padded), hour (zero padded), minute (zero padded), then you can sort by time easily: FILENAME=`date '+%Y-%m-%d-%H-%M'`-`uuidgen -t` echo $FILENAME Which would give you: 2015-02-23-08-37-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx You can choose other delimiters for the date/time besides - as you wish,...

identifierForVendor changes on reinstall

ios,uuid,uniqueidentifier

It's a known bug. It seems like Apple made an update to AppStore that causes this new behavior for identifierForVendor around the 28:th May. If you search in the App Developer forum, there are other developers reporting the same problem. The signature gc from Apple have replied on the issue...

Can UUID be hardcoded in an App for multiple Devices?

android,bluetooth,uuid

UUID in bluetooth in most cases refers to id of service that bluetooth devices offers. Here are examples of UUIDs: https://www.bluetooth.org/en-us/specification/assigned-numbers/service-discovery So to answer your questions you can hardcoded it, it won't change as long as device that you connect to is serving the same service....

save and find uuid by mysql and yii

php,mysql,yii,find,uuid

The problem is that you have used the reserved mySql keyword 'key' as your column name. That's what generates the syntax error. It is best that you rename your column to something different than 'key', e.g. 'key1' or 'key_ad'. In mySql you can still execute the query with the column...

MySQL UUID_SHORT() gives error Out of range value for column

mysql,uuid,bigint

BIGINT and BIGINT UNSIGNED are not the same. All the integer data types are signed unless explicitly unsigned. But also, UUID_SHORT() is designed to produce unique but not random, not unpredictable, and always-incrementing values, which seems like a particularly bad choice for a salt, no? ...Especially since the RANDOM_BYTES() function...

Delete user from server if they delete app

ios,xcode,nsuserdefaults,uuid,udid

Alternatively, You can create a service in App that ping server once a day. if any device didnt respond from long time then delete it from database.

Autogenerate UUID or timeuuid in spring-data Cassandra?

java,cassandra,spring-data,uuid,spring-data-cassandra

You could always implement the default constructor: MyEntity() { id = UUIDs.timeBased(); } Would that be enough? This would obviously require an unnecessary generation on instantiation which would consume some random entropy on your system. However, if your system is not running with too much high pressure you should be...

How to create a 64 bit Unique Integer in Java?

java,random,64bit,long-integer,uuid

If you need the numbers to be unique in one process, robust between restarts, you can use a simple AtomicLong and a timer. private static final AtomicLong TS = new AtomicLong(); public static long getUniqueTimestamp() { long micros = System.currentTimeMillis() * 1000; for ( ; ; ) { long value...

Inserting and selecting UUIDs as binary(16)

mysql,binary,uuid

So, as a response to comments. The correct way of storing a 36-char UUID as binary(16) is to perform the insert in a manner like: INSERT INTO sometable (SOMECOLUMN,UUID) VALUES ("Something",UNHEX([the-uuid])) Unhex because an UUID is already a hexed value. This means retreiving the UUID can be done like: SELECT...

Transform CBPeripheral's UUID to string format :

objective-c,bluetooth-lowenergy,uuid,core-bluetooth

peripheral.UUID is deprecated as of OSX 10.9 per the Apple Documents To accomplish what you are trying to do, you use: [peripheral.identifier UUIDString] ...

Pass UUID value as a parameter to the function

postgresql,uuid,postgresql-9.3

You need a simple cast to make sure PostgreSQL understands, what you want to insert: INSERT INTO testz values(p_id::uuid, p_name); -- or: CAST(p_id AS uuid) Or (preferably) you need a function, with exact parameter types, like: CREATE OR REPLACE FUNCTION testz(p_id uuid, p_name text) RETURNS VOID AS $BODY$ BEGIN INSERT...

rails server not starting on rails 3.1.2

mysql,ruby-on-rails,localhost,uuid,ruby-1.9.3

It is possible that all dependencies are not installed. If you have not used rvm to install ruby, you should try using it to install your ruby version. rvm install 1.9.3 or rvm reinstall 1.9.3 refer https://rvm.io/rvm/install for step by step instructions....

Portable UUID on Linux

linux,uuid

Looks like systemd is now installed on most Linux distributions these days, therefore i can rely on /etc/machine-id being present and readable from a regular user.

Convert Two Longs to a Hex String

ruby,uuid

Try using the % string format operator like "%016x" (sixteen zero padded hex digits): a = 0xCAFEBABECAFEBABE # => 14627333968358193854 b = 0xDEADBEEFDEADBEEF # => 16045690984833335023 '%016x%016x' % [a, b] # => "cafebabecafebabedeadbeefdeadbeef" There are many ways to insert the dashes at the right places if you want to get...

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

cassandra,uuid

Use TimeUUID cql3 data type: A value of the timeuuid type is a Type 1 UUID. A type 1 UUID includes the time of its generation and are sorted by timestamp, making them ideal for use in applications requiring conflict-free timestamps. For example, you can use this type to identify...

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

java,uuid,novell,novell-idm,netiq

Try using String.valueOf(id) in place of CN, where id is the random UUID generated. Regards...

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

c++,c,linux,uuid

I think the answer to your question will depend on what you consider to be a "permanent" part of the system. Let's assume you decide that the hard drive partitions are semi-permanent from your applications perspective, then calculate some sort of hash of the contents of /proc/paritions. In bash, something...

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

c++,boost,uuid,boost-uuid

The code you had does nothing in terms of validation. Instead it generates a UUID based on the constant passed (like a hash function). Looking closer I was mistaken. The missing bit of validation appears to be a check on version: Live On Coliru #include <boost/uuid/uuid.hpp> #include <boost/uuid/uuid_io.hpp> #include...

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

algorithm,uuid,boost-uuid

I'm not familiar with boost-uuid, but I think that what you need is a name-based UUID generator (see RFC-4122 Section 4.3). Read that section of the RFC to ensure it fits your requirements. Googling a bit, I found that boost does support name-based UUIDs: ...

Validate UUID without divider “-”

java,regex,validation,uuid

try regex uuid = uuid.replaceAll("(.{8})(.{4})(.{4})(.{4})(.+)", "$1-$2-$3-$4-$5"); UUID.fromString(uuid); ...

Find row by UUID stored as binary in SequelizeJS

mysql,node.js,uuid,sequelize.js

Solved it by supplying a fixed size empty Buffer object to uuid.parse(). Got it working initially using ByteBuffer, but then realised that the same can be achieved using uuid.parse() Org.find({ where: { id: uuid.parse(orgId, new Buffer(16)) } }).then(function(org) { console.log('Something happened'); console.log(org); }).catch(function(err) { console.log(err); }); Executing (default): SELECT `id`,...

Does two device will have the same 'UUID'

ios,ios7,uuid,uniqueidentifier,uidevice

No, Two device does not have the same UUID. I am 100% Sure about it. So go with identifierForVendor method. But, The UUID may be changed when you reinstall the the application in your device (If there is not other application for the same vendor). The value in this property...

Who send message in pubnub? iOS

ios,client,uuid,identifier,pubnub

Had the same problem yesterday, what I did was to send in the message a dictionary and not as a single string. For example : NSDictionary *message = @{kSenderName:user.username,kSenderId:user.objectId,kReciverId:objectId,kReciver:recover.username, kMessage:@"here goes the message itself"}; and then send - [PubNub sendMessage: message toChannel:self.groupChannel withCompletionBlock:^(PNMessageState state, id obj) { }]; And on...

neo4j: Cypher LOAD CSV with uuid

csv,neo4j,cypher,uuid,load-csv

Not sure where you've seen that {uuid} is a function. It is just using whatever you pass in as an parameter "uuid". You'd have to generate a uuid when creating your CSV. In cypher there is currently no uuid() function. One workaround that you could do is: LOAD CSV FROM...

Changing the UUID algorithm in CouchDB

algorithm,couchdb,uuid

There are a couple of things you can check. Have you added another configuration file? You can chain config files in couchdb and if you do only the changes from the last file in the chain will be used. Make a call to the http://localhost:5984/_config/uuids to get the info about...

Making a GDB debugging helper for the QUuid class

python,c++,debugging,gdb,uuid

The following python script should do the job: from dumper import * import gdb def qdump__QUuid(d, value): this = d.makeExpression(value) stringValue = gdb.parse_and_eval("%s.toString()" % this) d.putStringValue(stringValue) d.putNumChild(0) The easiest way to use it with Qt Creator is to just paste these lines at the end of your <Qt-Creator-Install-Dir>/share/qtcreator/debugger/personaltypes.py file. In...

Find Device Locations using android UUID

cordova,geolocation,ionic-framework,phonegap-plugins,uuid

I don't think that is possible to get it from device UUID, but you can use following plugin to get location of your app user and save it in database on onDeviceReady event. hope it helps. https://github.com/apache/cordova-plugin-geolocation...

Reproduce uuid from java code in python

java,python,uuid

nameUUIDFromBytes only takes one parameter, which is supposed to be the concatenation of the namespace and name just like you say. The namespace parameter is supposed to be a UUID, and as far as I know, they don't have a null value defined. A "null uuid" can be passed to...

Bluetooth Shield V2.2 for arduino

ios,bluetooth,arduino,uuid,arduino-uno

1) Try to "scan" available Arduino board with BLE Shield - for example here is an existing iOS app https://itunes.apple.com/us/app/ble-arduino/id547628998?mt=8 2) check your device's documentations 3) try those UUID's https://github.com/michaelkroll/BLE-Shield/blob/master/firmware/BLE-Shield-v2.0.0/BLE-Shield_gatt.xml...

Different length of value from uuid_short function of mysql

mysql,uuid,amazon-rds

Looks like Amazon RDS has a different server ID than you. Sure enough, 255 << 56 = 18374686479671623680 (20 digits) http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html#function_uuid-short The UUID_SHORT() return value is constructed this way: (server_id & 255) << 56 + (server_startup_time_in_seconds << 24) + incremented_variable++; ...

UUID: required String, found:int

java,hash,uuid,incompatibletypeerror

Your method signature says you will return a String public static String shortUUID() but you are actually returning an int, since that's the return type of the hashCode() method return uuid.toString().hashCode(); Just change your method sig to: public static int shortUUID() EDIT - to answer comment There is no getInt()...

How to Save UUID in the keychain iOS?

ios,uuid,keychain

Here i Post My Own Answer. I get answer From this Link http://objectivecwithsuraj.blogspot.in/2014/01/unique-identifier-uuid-ios.html i use FDKeyChain and Write Following Code to Save UUID In KeyChain Just Define Two String like as static NSString * const KeychainItem_Service = @"FDKeychain"; static NSString * const KeychainItem_UUID = @"Local"; and For Get UUID I...

Making the most out of two 5-digit numbers

math,uuid

The key thing to understand here is that having n binary digits/bits will allow you to represent 2^n different numbers. One bit lets you represent two values (0 or 1). Each additional bit doubles the amount you could represent before. one bit lets you represent two (2 = 2^1) values,...

SQLAlchemy - How to get object's UUID available before commit/update/query?

python,sqlalchemy,instantiation,uuid

I suppose that your should use not commit method but flush method: Difference between flush and commit. Flush not store information into the hard disk but create all changes on primary key: Primary key attributes are populated immediately within the flush() process as they are generated and no call to...

Why do we need a canonical format for the GUID?

random,guid,uuid,bits,canonicalization

It is so that if you update the algorithm you can change that number. Otherwise 2 different algorithms could produce the exact same UUID for different reasons, leading to a collision. It is a version identifier. For example, consider a contrived simplistic UUID format: 00000000-00000000 time - ip now suppose...

How to Get Unique Identity From iOS Device?

ios,objective-c,uuid,udid,devicetoken

You can save UUID in the keychain, so even uninstall and reinstall app, you still can get it back.

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

django,uuid,django-generic-views

The reason your template tags are not working is because you need to actually return the instance in get_object(): def get_object(self): return Shipment.objects.get(pk=self.kwargs['trackid']) If you don't return anything, the method returns None (its the default return value); and thus your templates have nothing to show....

Renaming class - field value in Java

java,class,uuid

If you want the equivalent of c.uuid = newUuidValue; but with reflection, you just want: uuidField.set(c, newUuidValue); The first argument to set is a reference to the object whose field you want to modify....

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

python,django-templates,uuid

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 09:15:22.155000', u'text': u'Test' } } order = [data['uuid2'], data['uuid2']] Then, django goes... {% for uuid in order %} {% for key in uuid: %} {{ key }}{{...

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

ruby-on-rails,ruby,postgresql,uuid

Are UUIDs the best way to solve this? You could use them as a solution. If you do, you should build a new contacts table and model instead of trying to migrate the old model. As well as being tricky to implement, any migration would immediately make existing contact/invite...

Ruby on Rails 4.2 with Globalize gem for UUID table

ruby-on-rails,postgresql,gem,uuid,globalize

I was not able to use the hardcoded solution provided by Thomas Engelbrecht because not all my models use uuid. Since the model is delegated we can check it's primary key type by adding a method : def primary_key_type column_type(model.primary_key).to_sym end And i'm using Rails 4.2 so I can use...

How to generate 32 bit UUID in iOS?

ios,objective-c,uuid

A UUID by definition is 128-bit. A UUID is a 16-octet (128-bit) number. I believe you can make a 32-bit Unique identifier but it is advised against. If you really need to make a 32 bit Unique identifier here is a pseudo code tutorial that might help....

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

java,hash,uuid,sha256

UUID.nameUUIDFromBytes appears to basically just be MD5 hashing, with the result being represented as a UUID. It feels clearer to me to use a base64-encoded hash explicitly, partly as you can then control which hash gets used - which could be relevant if collisions pose any sort of security risk....