How to easily map c++ enums to strings

I have a bunch of enum types in some library header files that I'm using, and I want to have a way of converting enum values to user strings - and vice-versa. RTTI won't do it for me, because the...

C#: SkipLast implementation

I needed a method to give me all but the last item in a sequence. This is my current implementation: public static IEnumerable<T> SkipLast<T>(this IEnumerable<T> source) { using...

How to define enum in as3?

Is there a way to define an enum in AS3 in a way we do it in other languages? I can define constants with defined values like that: private const CONST_1:int = 0; private const CONST_2:int =...

How should I change my Graph structure (very slow insertion)?

This program I'm doing is about a social network, which means there are users and their profiles. The profiles structure is UserProfile. Now, there are various possible Graph implementations and I...

How to list imported modules?

How to enumerate all imported modules? E.g. I would like to get ['os', 'sys'] from this code: import os import sys

Convert Enumeration to a Set/List

Is there some one-liner bridge method to dump a given Enumeration to java.util.List or java.util.Set? Something built-in like Arrays.asList() or Collection.toArray() should exist somewhere, but...

Close all open forms except the main menu in C#

Trying to close all forms except for the main menu using FormCollection formsList = Application.OpenForms; with a foreach loop and saying, if (thisForm.Name != "Menu") thisForm.Close(); Which...

C#: circular enumeration of IEnumerable

There is the command hierarchy in my current application. public interface ICommand { void Execute(); } So, some commands are stateful, some are not. I need to enumerate IEnumerable in the...

Database normalization - who's right?

My professor (who claimed to have a firm understanding about systems development for many years) and I are arguing about the design of our database. As an example: My professor insists this design...

(Z3Py) checking all solutions for equation

In Z3Py, how can I check if equation for given constraints have only one solution? If more than one solution, how can I enumerate them?

Count Image Files in Directory

I'm trying to enumerate and import a number of image files in a folder. My current code for counting the images is as follows - Dim fullpath As String fullpath = TxtPath.Text + "\" Dim...

Enumerating cycles in a graph using Tarjan's algorithm

I'm trying to determine the cycles in a directed graph using Tarjan's algorithm, presented in his research paper "Enumeration of the elementary circuits of a directed graph" from Septermber...

How to shorten the timezone name list got from moment.js?

I am using moment.js ( the method I used is moment.tz.names()) to retrieve the timezone name list which enumerates over 500 cities across the world. The long list makes it not very efficient for...

Solving many tiny linear programming problems quickly on embedded

As part of some live rendering process for a program that runs on iOS/Android, written in C/C++, I need to solve many tiny linear programming problems, with 5 variables and 2 constraints,...

Re-Enumerate and use PCIe SSD in Linux without shutdown

Good day, I am currently working on a project where PCIe SSDs are constantly being swapped out and tested through benchmark programs such as VDBench and Iometer. The problem I face right now,...

How to adjust export image size in PowerPoint using vba?

I'm creating a macro in PowerPoint VBA to export an image from the current slide. The export image will be the first image having a width larder than 250 units. The image is stored as a Shape, so...

Convert ContentAlignment to StringAlignment

I want to modify a Button, but have some difficulty in setting its text alignment correctly. Its text alignment is expressed using the ContentAlignment enumeration, so I have: Private goTextAlign...

Does C# 7 have array/enumerable destructuring?

In JavaScript ES6, you are able to destructure arrays like this: const [a,b,...rest] = someArray; where a is the first element in the array, b is the second, and rest is an array with the...

Show counter / index in SAPUI5 List Control through XML view

Is there a way to access an internal counter or index property of list items in an XML view, while iterating over the items of a SAPUI5 List control? The use case could be to simply enumerate the...

Collection was modified; enumeration operation may not execute. EF Core 2.2

i need some help with this problem, i using EF Core 2.2 and ASP.Net Core 2.2 i'm trying to delete some phones from my entity (User) but when execute dbcontext.SaveChanges() generate a exception:...

Execution failed for task ':app:minifyReleaseWithR8'.java.lang.NullPointerException (no error message)

when id update android studio to 3.6 android gradle tools to 3.6.0 ,there is a problem.when I generate sign apk,I got an exception,it is like this Execution failed for task...

Chocolately `Get-ExecutionPolicy` - Uncaught ReferenceError: Get is not defined

I am following the Chocolately Install steps (Windows 7), but have run into a couple of problems. Firstly, I've opened Command Prompt (opening it with Run as administrator), but when trying to...

NumPy - descending stable arg-sort of arrays of any dtype

NumPy's np.argsort is able to do stable sorting through passing kind = 'stable' argument. Also np.argsort doesn't support reverse (descending) order. If non-stable behavior is needed then...

Create a Script: Enumerate Access Control Lists

I am "attempting" to create a script using a foreach loop in order to display the ACL's in that directory. Here are the instructions : Above the foreach condition, set a variable, $directory, to...

How to enumerate an IAsyncEnumerable<T> and invoke an async action for each element, allowing concurrency for each iteration/action pair?

I have an IAsyncEnumerable<string> stream that contains data downloaded from the web, and I want to save asynchronously each piece of data in a SQL database. So I used the ForEachAwaitAsync...

Split HTML file by <section>, into separate include files?

I want to split a HTML file, by the <section> tag, into separate files. An example might be: mypage.html <!DOCTYPE html> <html> <head> ... </head> <body> <!-- Section 1 --> ...

NestJS/Mongoose: serialization does not exclude properties in plain output

I've started to play with NestJS, migrating from my old express/mongoose project and immediately crashed into a fence, just following MongoDB/serializations chapters from NestJS docs. I've...

What are all the reasons `fgetc()` might return `EOF`?

Certainly fgetc() returns EOF when end-of-file or an input error occurs, but is that all and does that mean no more data is available? FILE *inf = ...; int ch; while ((ch = fgetc(inf)) != EOF) { ...

Can I compute a type's cardinality generically?

I'd like to have a type class that tells me how big various types are. data Cardinality = Finite Natural | Infinite class Sized a where cardinality :: Cardinality It's pretty straightforward to...

Is there a better way to compare two C structs?

Let's assume that I declared a C struct for holding configuration information, which has lots of fields(~30), e.g.: struct config { int a; int b; int c; ... char *str1; ...

Relevant tags