guid

shortest encoding for Guid for use in a URL

不问归期 提交于 2019-12-19 05:22:24
问题 Mad Kristensen got one down to 00amyWGct0y_ze4lIsj2Mw Can it go smaller than that? 回答1: Looks like there are only 73 characters that can be used unescaped in a URL. IF that's the case, you could convert the 128-bit number to base 73, and have a 21 character URL. IF you can find 85 legal characters, you can get down to a 20 character URL. 回答2: A GUID looks like this c9a646d3-9c61-4cb7-bfcd-ee2522c8f633 - that's 32 hex digits, each encoding 4 bits, so 128 bits in total A base64 encoding uses 6

微软的COM中GUID和UUID、CLSID、IID

最后都变了- 提交于 2019-12-18 19:23:10
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 当初微软设计com规范的时候,有两种选择来保证用户的设计的com组件可以全球唯一: 第一种是采用和Internet地址一样的管理方式,成立一个管理机构,用户如果想开发一个COM组件的时候需要向该机构提出申请,并交一定的费用。 第二种是发明一种算法,每次都能产生一个全球唯一的COM组件标识符。 第一种方法,用户使用起来太不方便,微软采用第 二种方法,并发明了一种算法,这种算法用GUID(Globally Unique Identifiers)来标识COM组件,GUID是一个128位长的数字,一般用16进制表示。算法的核心思想是结合机器的网卡、当地时间、一个随即 数来生成GUID。从理论上讲,如果一台机器每秒产生10000000个GUID,则可以保证(概率意义上)3240年不重复。 GUID的例子: 54BF6567--1007--11D1--B0AA--444553540000 HKEY_CLASSES_ROOT/CLSID/{002B9E07-2E10-438F-AF1E-40E6A96F1EE4} 在微软的COM中GUID和UUID、CLSID、IID是一回事,只不过各自代表的意义不同: UUID : 代表COM CLSID : 代表COM组件中的类 IID :代表COM组件中的接口 在程序中

Is using a GUID security though obscurity?

久未见 提交于 2019-12-18 18:56:12
问题 If you use a GUID as a password for a publicly facing application as a means to gain access to a service, is this security through obscurity? I think the obvious answer is yes, but the level of security seems very high to me since the chances of guessing a GUID is very very low correct? Update The GUID will be stored in a device, when plugged in, will send over the GUID via SSL connection. Maybe I could generate a GUID, then do a AES 128 bit encrption on the GUID and store that value on the

Is Guid considered a value type or reference type?

那年仲夏 提交于 2019-12-18 18:49:33
问题 Guids are created using the new keyword which makes me think it's a reference type. Is this correct? Guid uid = new Guid(); Are Guids stored on the heap? 回答1: You can see the definition of a Guid yourself: public struct Guid ... Or you can test it like this: bool guidIsValueType = typeof(Guid).IsValueType; GUID's are created using the new keyword which makes me think it's a reference type. Structs can have constructors too, for example new DateTime(2012, 12, 23) . 回答2: Guid is a Value Type.

cannot convert from 'System.Guid?' to 'System.Guid'

♀尐吖头ヾ 提交于 2019-12-18 18:47:12
问题 Does anyone know how to deal with this error? cannot convert from 'System.Guid?' to 'System.Guid' 回答1: See MSDN. In that case, merely use myNullableVariable.Value (if you're sure it has a value), or (myNullableVariable.HasValue)?myNullableVariable.Value:somedefaulthere if you're not. One can also use GetValueOrDefault() if one doesn't care if the default is a specific value when the nullable really is null. The last way to do it is this: myNullableVariable.Value ?? defaultvalue . See,

Inserting GUID into SQL Server

二次信任 提交于 2019-12-18 14:54:17
问题 I have a stored proc were I want to insert a GUID (user id) into a table in MS SQL but I keep getting an error about the hyphen '-' that is part of the guid value, here's my proc defined below; @userID uniqueidentifier, @bookID int, @dateReserved datetime, @status bit INSERT INTO Reservation(BookId, DateReserved, [Status], UserId) VALUES (@bookID, @dateReserved, @status, @userID) But when I put single quotes around the value if the stored proc is executed in Management Studio, it runs fine.

Efficient data structure for GUIDs

元气小坏坏 提交于 2019-12-18 13:01:42
问题 I am in search of a data structure which enables me to quickly (prefarably O(1)-quickly) determine if a given GUID is a member of a Collection of GUIDs or not. My current approach is to use a TDictionary with 0 as values. While this works quickly, it seems to be a waste to use a Hashmap to rehash a GUID, which is by defintion considered to be unique, and to have the Dictionary handle values which are unneeded. There must be a better solution for this, but I can't find one. Can you? 回答1: I

SQL Server - Guid VS. Long

巧了我就是萌 提交于 2019-12-18 11:44:22
问题 Up until now i've been using the C# "Guid = Guid.NewGuid();" method to generate a unique ID that can be stored as the ID field in some of my SQL Server database tables using Linq to SQL. I've been informed that for indexing reasons, using a GUID is a bad idea and that I should use an auto-incrementing Long instead. Will using a long speed up my database transactions? If so, how do I go about generating unique ID's that are of type Long? Regards, 回答1: Both have pros and cons, it depends

MS SQL Server Row GUID Column

早过忘川 提交于 2019-12-18 10:49:13
问题 I apologize for asking what seems like a tired question, but no forum response or documentation I've read seems to provide an adequate answer. What is the purpose of the Row GUID Column property in MS SQL Server 2008? Let me extend on that. I've seen "Don't use GUID as the PK" repeated as the answer for this question, which seems to be completely unrelated to me. If I set Row GUID Column is it forcing that GUID column to be the primary key or something? To rephrase my original question: If I

Proposal: locally unique GUID alternative

安稳与你 提交于 2019-12-18 09:10:13
问题 The problem I'm looking for feedback on this exploration of a locally unique alternative for GUIDs , with the following requirements: Has very low chance of collisions (to the point that we'd rather collide once a year than perform checks) Does not leak sensitive information, such as how many items exist Has high performance in an SQL database Is copy/pastable for manual querying (as both query string and query result) Is usable as a URI component without encoding To meet the requirements, I