guid

Guid == null should not be allowed by the compiler

ε祈祈猫儿з 提交于 2019-11-27 20:59:36
The behaviour described below is specific to .net-3.5 only I just ran across the most astonishing behavior in the C# compiler; I have the following code: Guid g1 = Guid.Empty; bool b1= (g1 == null); Well, Guid is not nullable therefore it can never be equal to null . The comparison i'm making in line 2 always returns false . If you make the same thing for an integer, the compiler issues an warning saying the result will always be false: int x=0; bool b2= (x==null); My question is: Why does the compiler lets you compare a Guid to null ? According to my knowledge, it already knows the result is

What is the correct way of using the Guid type in a XSD file?

删除回忆录丶 提交于 2019-11-27 20:29:22
I have a .xsd file which I use to generate code with the xsd.exe tool from Visual Studio. Some class members are Guids and the xsd.exe tool gives 2 warnings: Namespace ' http://microsoft.com/wsdl/types/ ' is not available to be referenced in this schema. Type ' http://microsoft.com/wsdl/types/:guid ' is not declared. The Guid type is recognized because the generated C# file is valid and works. Anyone knows how to get rid of those warnings? What is the correct syntax for the XSD to be validated AND class members being generated as System.Guid? erbi Thank you all, I found how to remove the

Should I get rid of clustered indexes on Guid columns

▼魔方 西西 提交于 2019-11-27 20:25:50
I am working on a database that usually uses GUIDs as primary keys. By default SQL Server places a clustered index on primary key columns. I understand that this is a silly idea for GUID columns, and that non-clustered indexes are better. What do you think - should I get rid of all the clustered indexes and replace them with non-clustered indexes? Why wouldn't SQL's performance tuner offer this as a recommendation? A big reason for a clustered index is when you often want to retrieve rows for a range of values for a given column. Because the data is physically arranged in that order, the rows

WIX Autogenerate GUID *?

杀马特。学长 韩版系。学妹 提交于 2019-11-27 20:04:33
Let's say I generate my WIX XML file with a Product Id of *. Also for each Component GUID I use a *. <Product Id="*" Name="xxx" Language="1033" Version="1.0.0.0" Manufacturer="xxx" UpgradeCode="xxx"> Behind the scenes is the * spinning a unique GUID each time I compile my WIX Installer? Let's say I have version 1.0.0 installed a machine. Then I recompile my WIX Installer to version 1.0.1. When I go to install 1.0.1 how does WIX know that 1.0.0 is already installed and thus will remove all files/registry entries and install 1.0.1? Should I be using * from GUID or should I have a unique ID/GUID

How to generate a GUID in Oracle?

半城伤御伤魂 提交于 2019-11-27 19:52:55
问题 Is it possible to auto-generate a GUID into an Insert statement? Also, what type of field should I use to store this GUID? 回答1: 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

Performance - using Guid object or Guid string as Key

余生长醉 提交于 2019-11-27 19:35:42
When using a Guid as an index for a Dictionary , is it better to use the Guid object, or the string representation of the Guid? I just refactored some code which was using string to use the object, because there were new Guid() calls all over the place. But that left me wondering what the performance issues might be. (The collections are fairly small, but they get iterated lots of times.) The Guid should be quicker, as the comparison is simpler - just a few direct bytes. The string involves a dereference and lots more work. Of course - you could profile ;-p Evidence: Searching for 7f9b349f

Why are there dashes in a .NET GUID?

心已入冬 提交于 2019-11-27 19:35:38
Why are there dashes in a .NET GUID? Are there dashes in most implementations of a GUID, or is it just a Microsoft thing? Signed, 741ecf77-9c92-4435-8e6b-85975bd13452 casperOne Technically, there are no "dashes" in a GUID . A GUID is a 128-bit value which is usually stored in the following manner (using C# here to represent the structure): public struct Guid { public ulong Data1; public ushort Data2; public ushort Data3; public fixed byte Data4[8]; } The dashes are in the string representation of a GUID. The dashes are optional and are not required in a string representation of a GUID. That

guid to base64, for URL

随声附和 提交于 2019-11-27 18:58:05
Question: is there a better way to do that? VB.Net Function GuidToBase64(ByVal guid As Guid) As String Return Convert.ToBase64String(guid.ToByteArray).Replace("/", "-").Replace("+", "_").Replace("=", "") End Function Function Base64ToGuid(ByVal base64 As String) As Guid Dim guid As Guid base64 = base64.Replace("-", "/").Replace("_", "+") & "==" Try guid = New Guid(Convert.FromBase64String(base64)) Catch ex As Exception Throw New Exception("Bad Base64 conversion to GUID", ex) End Try Return guid End Function C# public string GuidToBase64(Guid guid) { return Convert.ToBase64String(guid

What is the probability of guessing (matching) a Guid?

一曲冷凌霜 提交于 2019-11-27 17:54:59
问题 Just curious but what is the probability of matching a Guid? Say a Guid from SQL server: 5AC7E650-CFC3-4534-803C-E7E5BBE29B3D is it a factorial?: (36*32)! = (1152)! discuss =D 回答1: It's not clear what you're asking. I see two ways to interpret your question. Given a GUID g , what is the probability of someone guessing it? Let's assume for simplicity that all 128 bits of a GUID are available. Then the probability of guessing g is 2^-128 . That's small. Let's get some intuition around that. Let

Is a GUID a good key for (temporary) encryption?

∥☆過路亽.° 提交于 2019-11-27 17:44:40
问题 I'm generating an encryption key to encrypt some sensitive data with the Rijndael (AES) encryption algoritm. I'm using a guid as key generator. Are these keys "strong" enough? Note: it is only sensitive for 20 minutes. 回答1: No. The GUID keys can be predicted, at least those generated by .NET / WinAPI. Also keep in mind that the GUID does not even have a true 128bit randomness, because the version number is fixed. This gives you a very weak key in the first place. To make matters worse,