guid

Outputting a GUID in VBScript ignores all text after it

﹥>﹥吖頭↗ 提交于 2019-12-04 23:44:59
I'm creating a GUID for use in a Classic ASP application, by using TypeLib. However, even a simple test such as writing the GUID out to the screen is giving me problems - it prints the GUID but ignores everything after it (e.g. HTML tags, additional words, anything). Here's the rudimentary code to test this: Set typeLib = Server.CreateObject("Scriptlet.TypeLib") myGuid = typeLib.Guid Response.Write myGuid & " is the new GUID" Set typeLib = Nothing This will display something like {9DDB27D1-F034-41D7-BB88-D0D811DB91CE} and that's it; the rest of the text is ignored and isn't written out.

Using Guid as Id column in NHibernate causes format exception when using MySQL

对着背影说爱祢 提交于 2019-12-04 23:43:32
问题 When I define the NHibernate entity/mapping to use Guid as identity column I receive an exception. The Guid column is generated as a varchar(40), but the content seem to be binary. Is there a solution to this? For now I'm just using plain ol' int, but it would be nice to know for future projects! :) 回答1: MySql Connector documentation states that from version 5.2 of .NET connector they treat GUID's as BINARY(16) not VARCHAR(40) . Since current MySQL dialect in nhibernate doesn't updated to

How to Combine Two GUID Values

强颜欢笑 提交于 2019-12-04 17:16:57
I want to combine two guid values and generate a 32 bit alphanumberic value(It can be done by using hashing). Not Pretty, but it works.. private static Guid MungeTwoGuids(Guid guid1, Guid guid2) { const int BYTECOUNT = 16; byte[] destByte = new byte[BYTECOUNT]; byte[] guid1Byte = guid1.ToByteArray(); byte[] guid2Byte = guid2.ToByteArray(); for (int i = 0; i < BYTECOUNT; i++) { destByte[i] = (byte) (guid1Byte[i] ^ guid2Byte[i]); } return new Guid(destByte); } and yes, I can deal with the non-unique-guarantee in my case What about splitting the Guids into 2 chunks of 8 bytes each, convert them

Why isn't Guid.ToString(“n”) the same as a hex string generated from a byte array of the same guid?

倾然丶 夕夏残阳落幕 提交于 2019-12-04 17:09:46
问题 Consider the following unit test: [TestMethod] public void TestByteToString() { var guid = new Guid("61772f3ae5de5f4a8577eb1003c5c054"); var guidString = guid.ToString("n"); var byteString = ToHexString(guid.ToByteArray()); Assert.AreEqual(guidString, byteString); } private String ToHexString(Byte[] bytes) { var hex = new StringBuilder(bytes.Length * 2); foreach(var b in bytes) { hex.AppendFormat("{0:x2}", b); } return hex.ToString(); } Here's the result: Assert.AreEqual failed. Expected:

Convert byte[] or object to GUID

浪子不回头ぞ 提交于 2019-12-04 16:53:40
问题 I assigned some value to object data type like, object objData =dc.GetDirectoryEntry().Properties["objectGUID"].Value; this object retun the value like {byte[16]} [0]: 145 [1]: 104 [2]: 117 [3]: 139 [4]: 124 [5]: 15 [6]: 255 [7]: 68 [8]: 142 [9]: 159 [10]: 208 [11]: 102 [12]: 148 [13]: 157 [14]: 179 [15]: 75 Then i casting this object to byte[], like byte[] binaryData = objData as byte[]; It will also return like, {byte[16]} [0]: 145 [1]: 104 [2]: 117 [3]: 139 [4]: 124 [5]: 15 [6]: 255 [7]:

How to use the objectGUID get a DirectoryEntry?

痴心易碎 提交于 2019-12-04 16:35:30
I know ,we can get a DirectoryEntry like this: string conPath = "LDAP://10.0.0.6/DC=wds,DC=gaga,DC=com"; string conUser = "administrator"; string conPwd = "Iampassword"; DirectoryEntry de = new DirectoryEntry(conPath, conUser, conPwd, AuthenticationTypes.Secure); and we can change a user's password like this: DirectorySearcher deSearch = new DirectorySearcher(); deSearch.SearchRoot = de; deSearch.Filter = String.Format("sAMAccountName={0}", "xumai"); SearchResultCollection results = deSearch.FindAll(); foreach (SearchResult objResult in results) { DirectoryEntry obj = objResult

Should assembly guid attribute vary for different target framework builds of the same .NET library?

不羁的心 提交于 2019-12-04 15:19:20
I am developing a .NET library in C# which has to address a wide set of target frameworks. I want to produce a nuget package that would install correctly according to the settings of the target project. In order to achieve that, I am using multiple .csproj files. Each of them is addressing a particular target framework (for example MyLibrary.net45.csproj would create the binaries in bin/*/net45 , MyLibrary.netstandard1.2.csproj would create the output in bin/*/netstandard1.2 , and so on). Then I create a single nuget package with the outputs of the above projects. At this stage, the different

How safe is it to rely on hashes for file identification?

孤街醉人 提交于 2019-12-04 13:40:29
问题 I am designing a storage cloud software on top of a LAMP stack. Files could have an internal ID, but it would have many advantages to store them not with an incrementing id as filename in the servers filesystems, but using an hash as filename. Also hashes as identifier in the database would have a lot of advantages if the currently centralized database should be sharded or decentralized or some sort of master-master high availability environment should be set up. But I am not sure about that

获取newsequentialid()的值

∥☆過路亽.° 提交于 2019-12-04 12:04:36
DB中表的主键为uniqueidentifier且没有另建聚集索引时,使用newsequentialid()作为默认值来生成顺序的guid 有时程序需要在insert后获取到生成的guid继续处理,如,插入到其他表中。获取方法如下: 声明表变量,通过output inserted读取生成ID declare @tb_id table(ID uniqueidentifier) insert into TableTest(Col1,Col2) OUTPUT INSERTED.TestID INTO @tb_id values('Col1Value','Col2Value') select ID from @tb_id    来源: https://www.cnblogs.com/zoex/p/11862918.html

SQL Server -is a GUID based PK the best practice to support tenant based horizontal partitioning

谁说胖子不能爱 提交于 2019-12-04 11:27:24
问题 I’m trying to figure out what the best approach is when designing a multi tenant database schema that will need to be horizontally partitioned in the future. Some Rough Numbers on the database.. Total number of tenants will be approx 10,000. The amount of data stored per tenant varies between 500MB -> 3GB. The number of tenants will start off small and grow to 10,000 over a few years so initially we can start with a single multi tenant database but in the longer term this will need to scale