guid

How to generate a GUID in Oracle?

喜你入骨 提交于 2019-11-28 16:09:16
Is it possible to auto-generate a GUID into an Insert statement? Also, what type of field should I use to store this GUID? Tony Andrews You can use the SYS_GUID() function to generate a GUID in your insert statement: insert into mytable (guid_col, data) values (sys_guid(), 'xxx'); The preferred datatype for storing GUIDs is RAW(16). As Gopinath answer: select sys_guid() from dual union all select sys_guid() from dual union all select sys_guid() from dual You get 88FDC68C75DDF955E040449808B55601 88FDC68C75DEF955E040449808B55601 88FDC68C75DFF955E040449808B55601 As Tony Andrews says, differs only

Guid.NewGuid() vs. new Guid()

╄→гoц情女王★ 提交于 2019-11-28 15:16:46
What's the difference between Guid.NewGuid() and new Guid() ? Which one is preferred? MarkPflug new Guid() makes an "empty" all-0 guid (00000000-0000-0000-0000-000000000000 is not very useful). Guid.NewGuid() makes an actual guid with a unique value, what you probably want. Guid.NewGuid() creates a new UUID using an algorithm that is designed to make collisions very, very unlikely. new Guid() creates a UUID that is all-zeros. Generally you would prefer the former, because that's the point of a UUID (unless you're receiving it from somewhere else of course). There are cases where you do indeed

Generate a UUID on iOS from Swift

社会主义新天地 提交于 2019-11-28 15:07:08
In my iOS Swift app I want to generate random UUID ( GUID ) strings for use as a table key, and this snippet appears to work: let uuid = CFUUIDCreateString(nil, CFUUIDCreate(nil)) Is this safe? Or is there perhaps a better (recommended) approach? Ahmed Al Hafoudh Try this one: let uuid = NSUUID().uuidString print(uuid) Swift 3/4 let uuid = UUID().uuidString print(uuid) You could also just use the NSUUID API: let uuid = NSUUID() If you want to get the string value back out, you can use uuid.UUIDString . Note that NSUUID is available from iOS 6 and up. For Swift 4 ; let uuid = NSUUID()

how are GUIDs generated in SQL Server?

♀尐吖头ヾ 提交于 2019-11-28 13:36:04
How are GUIDs generated in SQL Server? I understand that I should use newid() , but what is the algorithm that function uses? Is it a hash of the time/date? SQLMenace The algorithm to create it is described here: http://en.wikipedia.org/wiki/Globally_Unique_Identifier Algorithm In the OSF-specified algorithm for generating new (V1) GUIDs, the user's network card MAC address is used as a base for the last group of GUID digits, which means, for example, that a document can be tracked back to the computer that created it. This privacy hole was used when locating the creator of the Melissa worm[2]

How to predict the next GUID from a given GUID?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 12:46:38
I have sent 10000 mails to our customers and each mail had a link of the format http://example.com/LogIn?key={guid} Unfortunately the guid I sent were random guids (test data generated by Guid.NewGuid() ) so the customers have all received invalid links... Based on the 404s i receive from the webserver I have a few guids that I sent out. I have read that the guid generator in windows is weak so you can predict the next guid from one you already have. Does anyone know how? If i could do that I could make the guids I sent out valid so the links would work again. Will Dean The way Windows has

Referencing GUIDs

别等时光非礼了梦想. 提交于 2019-11-28 12:28:56
I'm trying to capture an event and reference a GUID to see which event it is. The code is below: DWORD WINAPI AvisionEventProc(LPVOID lpParam){ //HANDLE hEvent = * (HANDLE *) lpParam; // This thread's read event STINOTIFY pStiNotify; if (debug){ wprintf(L"Avision Event\n"); } while(true){ WaitForSingleObject(hAvisionEvent, INFINITE); wprintf(L"Event"); pStiDevice->GetLastNotificationData(&pStiNotify); if (pStiNotify.guidNotificationCode == GUID_STIUserDefined1){ wprintf(L"User defined 1"); }else if (pStiNotify.guidNotificationCode == GUID_STIUserDefined2){ wprintf(L"User defined 2"); }else if

Guid Byte Order in .NET

房东的猫 提交于 2019-11-28 10:50:27
I am creating a GUID like this Guid g = new Guid(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF }); Console.WriteLine(g); This outputs 03020100-0504-0706-0809-0a0b0c0d0e0f According to Wikipedia there are four parts in the guid and this explains why the bytes order switch in four groups. However the Wikipedia article also states that all parts are stored in Big Endian format. Obviously the first three parts are not Big Endian. The GetBytes() method of the guid returns the bytes in the very same order used for creation. What is the explaination for this behavior? Grhm

.NET Native GUID conversion

半世苍凉 提交于 2019-11-28 10:27:48
I have an external database that is feeding information to me. One saves their data as native GUID format and my other data source supplies standard .NET GUID format string. Is there a tidy way to convert from Native GUID to GUID Structure ? Also is there any validation bit to determine if a provided value is a Native GUID or not? I can't seem to find any if there is one. The difference is as follows: typedef struct _GUID { DWORD Data1; WORD Data2; WORD Data3; BYTE Data4[8]; } GUID; Data1, Data2 and Data3 get their byte order reversed but Data4 remains the same, see http://en.wikipedia.org

Problem getting GUID string value in Linq-To-Entity query

社会主义新天地 提交于 2019-11-28 10:25:42
问题 I am trying to write a GUID value to a string in a linq select. The code can be seen below (where c.ID is GUID), but I get the following error: Unable to cast the type 'System.Guid' to type 'System.Object'. LINQ to Entities only supports casting Entity Data Model primitive types. var media = ( from media in Current.Context.MediaSet orderby media.CreatedDate select new Item { Link = "~/Media.aspx?id=" + media.ID, Text = "Media", Time = media.CreatedDate } ).ToList(); 回答1: One way would be to

Regex to get a guid from a email reply

*爱你&永不变心* 提交于 2019-11-28 09:52:57
Trying to figure out the Regex pattern to match if an email contains a Guid, e.g. a141aa94-3bec-4b68-b562-6b05fc2bfa48-reply@site.com The Guid could potentially be anywhere before the @, e.g. reply-a141aa94-3bec-4b68-b562-6b05fc2bfa48@wingertdesign.com I use this to find Guids Regex isGuid = new Regex(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", RegexOptions.Compiled); A lazy variant would be ([0-9a-f-]{36}).*?@ It is easy to read and I bet it matches 99,99% of all cases ;) But then in 0,00001% of all cases sombody could have an email