Questions tagged [enumeration]

The process of enumerating values, for example from some collection.

Use for enumeration types.

1894 questions
0
votes
2 answers

General Conversion Method of Enums

Here's what I want to do string MyEnumType = "SpaghettiDiameter"; string MyEnumValue = "NEEDS_ALL_SAUCE"; //this is not exact syntax - only to represent the logic //MyEnumValue is converted from string to the type contained in MyEnumType var…
Chuck Bland
  • 255
  • 1
  • 2
  • 13
0
votes
1 answer

Recursive function for guessing password in PHP?

I need to write a recursive function that can guess a 4 character long password. I am using this to generate a random "password": /*start random password generating code*/ $random_password = ""; $charset =…
0
votes
2 answers

C# - Enumerate directory for specific filetype then use each file in loop

Essentially I'm trying to migrate my code from a batch file (.bat) to a C# console application. I'm using Visual C# 2010 Express. Primary function is a TUI based assistant for a host of command line utilities. My problem should be simple. However I…
Terus
  • 203
  • 3
  • 12
0
votes
1 answer

scala reflection get class of enumaration value

Assume we have class User(val name: String, val role: UserRole.Value) class UserRole extends Enumeration { val Admin, User = Value } val u = new User("root", UserRole.Admin) how to get Class[_] "class UserRole" when u.role.getClass return…
Igor Yudnikov
  • 434
  • 1
  • 6
  • 14
0
votes
1 answer

Swift - Get first item in array, and return element and indices

I want to return the first item in a given array of custom objects and return an array of indices and the first custom object element so I can wrap a guard statement around it. ie: let firstOrder = existingOrders.enumerated().flatMap{$0,$1}.first or…
zardon
  • 1,601
  • 4
  • 23
  • 46
0
votes
1 answer

Shared enum between multiple threads

I have an enumeration that is shared between multiple threads: public enum Action { Read, Write, None } Within a class I have a variable of Action type: public Action _action; This is a shared variable, that is, it is updated and read…
Willy
  • 9,848
  • 22
  • 141
  • 284
0
votes
1 answer

Javascript enum: How to do a lookup by property value?

I have an enumeration defined like this: module.exports = { APP_TYPES: { TYPE_ONE: { id: 5, name: "Application One name"}, TYPE_TWO: { id: 9, name: "Application Two name"}, TYPE_THREE: { id: 6, name: "Application Three…
Selena
  • 2,208
  • 8
  • 29
  • 49
0
votes
2 answers

Access enum entries from anonymous struct

I've a code like this: struct { enum { entry, } en; } data; void foo() { switch(data.en) { } } that gives me a warning: main.cpp:13:11: warning: enumeration value 'entry' not handled in switch [-Wswitch] …
Michał Walenciak
  • 4,257
  • 4
  • 33
  • 61
0
votes
1 answer

Dreadful performance of MoveNext inside class implementing IEnumerable

I've got a wrapper class that's used in an MVC application that is designed to loop through the items in a collection and check that the current user has authorisation to access that item before returning it for display. For the most part it works…
Bob Tway
  • 9,301
  • 17
  • 80
  • 162
0
votes
2 answers

How to covert Scala Seq to Java Enumeration

I want to convert a scala Seq to Java java.util.Enumeration any tips?
Boynux
  • 5,958
  • 2
  • 21
  • 29
0
votes
1 answer

Python start line with a letter, combining two for loops?

I'm trying to have my program output: a. am {1: '2'} b. at {1: '2'} c. far {1: '1'} ... ff. glad {1: '2'} gg. i {1: '2'} hh. it {1: '1'} ... ooo. lets {1: '0'} ppp. outcome {1: '2'} The first part, the letters, is the line number but represented…
Ember
  • 15
  • 2
0
votes
0 answers

unable to list directory content for all file types in C:\ using C program

This is a C snippet I'm looking at #include #include #include static void list_dir(const char *path) { struct dirent *entry; DIR *dir = opendir(path); if (dir == NULL) { return; } while…
rhym1n
  • 87
  • 1
  • 2
  • 9
0
votes
1 answer

Options for Camera Enumeration and HAL for UWP App (WPF/C++ CLI DLL)

I am creating video processing application. The application is written using a mixture of WPF and C++/CLI (a DLL). I currently connect to a machine vision camera and use a few functions in the camera's native driver e.g. I grab image data, I set…
user3079907
  • 133
  • 1
  • 10
0
votes
0 answers

Using Table Names as the Foreign Key for Enumeration table type

I have a database schema having more than 40 tables out of which 25 are enumerations having following fields 1. Id (Int) 2. Item (String) I discussed this scenario here and found having different tables would be better approach. I implemented this…
Sracanis
  • 490
  • 5
  • 25
0
votes
6 answers

Enumerations in C++

I have the code void switchstate(gamestates state) --line 53 { --line 54 switch(state) case state_title: title(); break; case state_about: break; case state_game: break; case state_battle: …
Austin Gayler
  • 4,038
  • 8
  • 37
  • 60