guid

Implementing interface properties in interfaces?

匿名 (未验证) 提交于 2019-12-03 08:41:19
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a code base I want to use for both an ASP.NET MVC and a WPF/MVVM front end. The business objects are implement as interfaces and the business logic uses these interfaces for passing data. Say I have a property on my interface that implements IEnumerable. Is it possible to have different versions of this interface use different implementations of IEnumerable? An example of what I am trying to accomplish: class Reporting { public bool RunReport(IReportParams Params); } interface IReportParams { IEnumerable<Guid> SelectedItems { get; }

difference between UNHEX and X (MySQL)

僤鯓⒐⒋嵵緔 提交于 2019-12-03 08:26:45
问题 What really is the difference between MySQL UNHEX and X when dealing with hexadecimal values in a database? Eg. SELECT * FROM test WHERE guidCol IN (UNHEX('hexadecimalstring')); SELECT * FROM test WHERE guidCol IN (X'hexadecimalstring'); Both gives me exact result set. So is there any difference? Performance implications? Edit: the underlying type of guidCol is binary of course 回答1: UNHEX() is a function, therefore you can do something like SET @var = '41'; SELECT UNHEX(@var); SELECT UNHEX

Controling Volume Mixer

匿名 (未验证) 提交于 2019-12-03 07:50:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to control other application volume(firefox). i can do it with Volume Mixer What is the libraries of the Volume Mixer ? 回答1: Here is a sample C# Console Application that does it. It's based on the Windows Core Audio Library . It works only on Windows 7 and higher. using System; using System.Runtime.InteropServices; using System.Collections.Generic; namespace SetAppVolumne { class Program { static void Main(string[] args) { const string app = "Mozilla Firefox"; foreach (string name in EnumerateApplications()) { Console.WriteLine("name:

Creating multiple partitions on USB using C#

匿名 (未验证) 提交于 2019-12-03 07:36:14
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Iam trying to use DeviceIOControl to create multiple partiions in USB. It is always creating only one partition. Here is my source code [DllImport("kernel32.dll", SetLastError = true)] static extern IntPtr CreateFile(string lpFileName, uint dwDesiredAccess, uint dwShareMode, IntPtr lpSecurityAttributes, uint dwCreationDisposition, uint dwFlagsAndAttributes, IntPtr hTemplateFile); [DllImport("kernel32")] static extern int CloseHandle(IntPtr handle); [DllImport("kernel32")] private static extern int DeviceIoControl (IntPtr deviceHandle, uint

Guid.NewGuid() VS a random string generator from Random.Next()

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 06:45:52
问题 My colleague and I are debating which of these methods to use for auto generating user ID's and post ID's for identification in the database: One option uses a single instance of Random, and takes some useful parameters so it can be reused for all sorts of string-gen cases (i.e. from 4 digit numeric pins to 20 digit alphanumeric ids). Here's the code: // This is created once for the lifetime of the server instance class RandomStringGenerator { public const string ALPHANUMERIC_CAPS =

Print a GUID variable

流过昼夜 提交于 2019-12-03 06:30:38
问题 I have a GUID variable and I want to write inside a text file its value. GUID definition is: typedef struct _GUID { // size is 16 DWORD Data1; WORD Data2; WORD Data3; BYTE Data4[8]; } GUID; But I want to write its value like: CA04046D-0000-0000-0000-504944564944 I observed that: Data1 holds the decimal value for CA04046D Data2 holds the decimal value for 0 Data3 holds the decimal value for next 0 But what about the others? I have to interpret myself this values in order to get that output or

Aggregate Function on Uniqueidentifier (GUID)

 ̄綄美尐妖づ 提交于 2019-12-03 06:28:31
问题 Let's say I have the following table: category | guid ---------+----------------------- A | 5BC2... A | 6A1C... B | 92A2... Basically, I want to do the following SQL: SELECT category, MIN(guid) FROM myTable GROUP BY category It doesn't necessarily have to be MIN. I just want to return one GUID of each category. I don't care which one. Unfortunately, SQL Server does not allow MIN or MAX on GUIDs. Of course, I could convert the guid into a varchar, or create some nested TOP 1 SQL, but that

Duplicate returned by Guid.NewGuid()?

大憨熊 提交于 2019-12-03 06:11:07
We have an application that generates simulated data for one of our services for testing purposes. Each data item has a unique Guid. However, when we ran a test after some minor code changes to the simulator all of the objects generated by it had the same Guid. There was a single data object created, then a for loop where the properties of the object were modified, including a new unique Guid, and it was sent to the service via remoting (serializable, not marshal-by-ref, if that's what you're thinking), loop and do it again, etc. If we put a small Thread.Sleep( ...) inside of the loop, it

Is there any way to generate a guid in ANT?

被刻印的时光 ゝ 提交于 2019-12-03 05:16:08
I have an ant script to manage out build process. For WiX I need to produce a new guid when we produce a new version of the installer. Anyone have any idea how to do this in ANT? Any answer that uses built-in tasks would be preferable. But if I have to add another file, that's fine. I'd use a scriptdef task to define simple javascript task that wraps the Java UUID class, something like this: <scriptdef name="generateguid" language="javascript"> <attribute name="property" /> <![CDATA[ importClass( java.util.UUID ); project.setProperty( attributes.get( "property" ), UUID.randomUUID() ); ]]> <

How to convert a GUID to a string in C#?

放肆的年华 提交于 2019-12-03 05:13:06
I'm new to C#. I know in vb.net, i can do this: Dim guid as string = System.Guid.NewGuid.ToString In C#, I'm trying to do String guid = System.Guid.NewGuid().ToString; but i get an " Cannot convert method group 'ToString' to non-delegate type 'string'. Did you intend to invoke the method ?" error. Blindy You're missing the () after ToString that marks it as a function call vs. a function reference (the kind you pass to delegates), which incidentally is why c# has no AddressOf operator, it's implied by how you type it. Try this: string guid = System.Guid.NewGuid().ToString(); According to MSDN