enumeration

C# Converting set flags in a variable of type flag enumeration to an array of integers

I came up with this piece of code that converts the set flags in a variable of type Flag Enumeration and returns the set flags as integers. I'd like to know if this is the best approach. Example enumeration: [Flags] enum Status { None = 0x0, Active = 0x1, Inactive = 0x2, Canceled = 0x4, Suspended = 0x8 } The extension method...

how to enumerate all the div tag with same id?

I have web-pages based on widget and I have given all the div the same ID attribute. After the page is loaded, I want to enumerate all the div element which matches the ID element 'widget'. I am using jQuery. Then I want to get the internal div attribute within the 'widget' div which shall be used as a tooltip. <div id="widget" class=...

java.util.vector$1

enumeration e=vector.elements But vector class does not implement Enumeration, then how comes it is returning Enumeration Reference. But e is refering to java.util.vector$1 . What is "Vector$1"??? ...

What is the difference between ASN.1 enumerated type and choice type?

Can you give me an example to show when to use an enumeration and when to use a choice type with ASN.1? ...

Get Current Index for Removal in String Collection

I have a String Collection that is populated with ID's like so --> 12345 23456 34567 and so on. What I need to do is at the user's request, and when certain parameters are met, go through that list, starting at the top, and perform a method() using that ID. If successful I would remove it from the list and move on. I, embarrassingl...

C#: Collection was modified; enumeration operation may not execute

Hi everyone. My goal is to delete a user from the user list in my application.But i cannot get to the bottom of this error. Some one plz bail me out. if (txtEmailID.Text.Length > 0) { users = UserRespository.GetUserName(txtEmailID.Text); bool isUserAvailable=false; foreach (EduvisionUser aUser in users) // Exception thrown i...

count elements inside id<NSFastEnumeration>

I have an id<NSFastEnumeration> object. I want to count the elements inside the object. How can that be achieved? The only method NSFastEnumeration implements is: - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len This method returns the count I am looking for, but a...

Why is my array of enumeration values null in my WCF service?

I have an array of enumerations on a WCF reuqest that comes through as null, no matter what I have tried. The service works apart from the issue with enumerations. Does anyone have any ideas why this might be? Enumeration code: [DataContract(Namespace = "http://services.myproject.com/requests/MyProject")] public enum Recommend...

How to safely remove objects from NSMutableSet (cocos2d-iphone)

Hello. I'm rather new to serious programming, so please forgive my dumbness, but I've failed to figure this out by myself. I am writing a game with cocos2d-iphone. I have a scene object with several NSMutableSets in its ivars - units, buildings, rockets, etc. I have a problem removing objects from these NSMutableSets. When a bullet obj...

Enumerating m-tuples of Integers Subject to Implication Constraints

How do I enumerate all m-tuples of nonnegative integers (a[1],...,a[m]) subject to the following constraints? For each i in {1,...,m}, there is a number n[i] >= 0 such that a[i] <= n[i]. For each ordered pair (i,j) with i,j in {1,...,m}, there are numbers c[i][j], d[i][j] >= 0 such that: if a[i] > c[i][j], then a[j] <= d[i][j]. c[i][...

iPhone: Fast enumeration, not fast enough?

I am trying to loop through an NSSet that has about 6500 items in it. I am using: for (id Location in sortedArray) { loc = [sortedArray objectAtIndex:i]; cord = [cord stringByAppendingString:[NSString stringWithFormat:@"%f,%f ",[loc.longitude doubleValue],[loc.latitude doubleValue]]]; i++; } ...

Is there a way to iterate through HttpServletRequest.getAttributeNames() more than once?

I'm trying to log the contents of the HttpServletRequest attributes collection. I need to do this when the servlet first starts, and again right before the servlet is finished. I'm doing this in an attempt to understand a crufty and ill-maintained servlet. Because I need to have as little impact as possible, servlet filters are not an...

When you alter a table how do you detect the data type of columns?

I am running MySQL and I need to change the data type of certain columns from an enumeration to integer. However, there are a lot of columns. (If this exists) What is the syntax to alter all columns at the same time that are enumerations. Here is how I am updating a single column to make it integer data type: ALTER TABLE table_name CHAN...

python enumeration class for ORM purposes

EDITED QUESTION I'm trying to create a class factory that can generate enumeration-like classes with the following properties: Class is initialized from the list of allowed values (i.e., it's automatically generated!). Class creates one instance of itself for each of the allowed value. Class does not allow the creation of any addition...

WSDL, Enums and C#: It's still murky...

I tried to look this up online, but all the WSDL examples seem to not really explain if I should mark things as basetype string in the WSDL or int... Basically, I'm trying to make my WSDL so that I can represent an Enumeration. I have a C# Enum in mind already that I want to match it up to... public enum MyEnum { Item1 = 0, Ite...

How to read a properties file in java in the original order

I need to read a properties file and generate a Properties class in Java. I do so by using: Properties props = new Properties(); props.load(new FileInputStream(args[0])); for (Enumeration e = props.propertyNames(); e.hasMoreElements();) { } However, the properties returned by props.propertyName is not in the order of the original prop...

.Net enumerate winforms font styles?

I have been searching around for a way to list the valid font styles for a given font using the .Net framework (even if I have to pinvoke gdi32 or some other API) since not all fonts fall into the System.Drawing.FontStyle enum values (Bold, Italic, Regular, Strikeout, Underline). A perfect example of a font that does not fit the bill is...

Compare symbolic constant, enumeration, constant variable

symbolic constant- no type checking->the value is just substituted enumeration- more type safe than symbolic constant constant variables- most type safe Anything else that can be added here? Any difference in terms of space occupied by these? ...

Correct MultiChoice Values in LINQ to SharePoint Query

I am using a LINQ to SharePoint query to return items from a SharePoint list. var myOpenTasksQuery = from myTasks in tasks where myTasks.TaskStatus != TaskStatus.Completed select myTasks However, the list I am querying, an OOTB Tasks list, there are a number of multi-choice fields (Status,...

Enumerate NSDictionary with keys and objects, PHP style

I know you can Enumerate the keys or values of NSMutableDictionary using NSEnumerator. Is it possible to do both together? I'm looking for something similar to the PHP foreach enumerator like: foreach ($dictionary as $key => $value); ...