Developing a simple Windows system tray desktop app to consume a .NET web service

Keep it all in .NET. You can easily write a Windows Forms application to display a tray icon and display notifications as and when something happens in the web service (you’d probably need a timer to do the polling). There are plenty of articles around that will show you how to do this. Here’s one … Read more

C++ Reading the Data part of a WAV file

This image is taken from a Stanford course So you can see that the audio data occurs immediately after the headers you already read and there will be Subchunk2Size bytes of audio data. The pseudocode for this would be ReadRIFF(); ReadFMT(); int32 chunk2Id = Read32(BigEndian); int32 chunk2Size = Read32(LittleEndian); for (int i = 0; i … Read more

Are function attributes inherited?

I sent an email to the C++ committee, specifically the Core working group, and provided the above example. CoryKramer It is currently unclear from the standard if attributes applied to virtual functions are inherited. Response: They are not. For them to be inherited, the Standard would have to explicitly say so, and it does not. … Read more

Mark strings as non-nullable in ASP.NET Core 3.0 Swagger

You can now use nullable reference types to mark strings as optional or required: Enable nullable reference types for your project/solution Mark strings in Dtos as nullable: public class ExampleDto { [StringLength(64, MinimumLength = 4)] public string RequiredString { get; set; } [StringLength(200)] public string? OptionalString { get; set; } } Enable Swagger support in … Read more

Multiple statements in a switch expression: C# 8 [duplicate]

Your only supported choice is the func like you did. See [this article][1] for more information. His example: var result = operation switch { “+” => ((Func<int>)(() => { Log(“addition”); return a + b; }))(), “-” => ((Func<int>)(() => { Log(“subtraction”); return a – b; }))(), “/” => ((Func<int>)(() => { Log(“division”); return a / … Read more

Why does an empty vector call the value type’s default constructor?

Because you’re explicitly passing an initial size, which calls a constructor that has another parameter whose default value is s(). Just leave out the (0) (i.e. std::vector<s> v;) and it won’t happen. For completeness, the Standard 23.2.4-2 defines the constructor you’re calling as:     explicit vector(size_type n, const T& value =T(),                                     const Allocator& = Allocator()); Aside … Read more

How to forward typedef’d struct in .h

Move the typedef struct Preprocessor Prepro; to the header the file and the definition in the c file along with the Prepro_init definition. This is will forward declare it for you with no issues. Preprocessor.h #ifndef _PREPROCESSOR_H_ #define _PREPROCESSOR_H_ #define MAX_FILES 15 typedef struct Preprocessor Prepro; void Prepro_init(Prepro* p); #endif Preprocessor.c #include “Preprocessor.h” #include <stdio.h> … Read more

Are there any disadvantages to “multi-processor compilation” in Visual Studio?

The documentation for /MP says: Incompatible Options and Language Features The /MP option is incompatible with some compiler options and language features. If you use an incompatible compiler option with the /MP option, the compiler issues warning D9030 and ignores the /MP option. If you use an incompatible language feature, the compiler issues error C2813then … Read more