Search Results

Search found 2859 results on 115 pages for 'enum flags'.

Page 8/115 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Fluent Nhibernate expression to select on flagged enum

    - by mbalkema
    I have a domain entity that has a flagged enum as a property. The flagged enum is the target audience for the these entities. The user then has a flagged enum value of the entities they should see. I am trying to figure out the correct expression to select entities that meet the target audience for the user. public class File { public virtual TargetAudience TargetAudience { get; set; } } [Flags] public enum TargetAudience { Audience1 = 1, Audience2 = 2, Audience3 = 4, Audience4 = 8 } Expression: (This works when performed on a IList<File>, but doesn't work on a query to the database.) public Expression<Func<File, bool>> Expression { get { return ((x.TargetAudience & UserTargetedAudience) > 0); } } Any suggestions would be helpful.

    Read the article

  • JCombobox containing enum values inside a table

    - by Edan
    Hello, I have a class containing Enum with values. (names) In other class I would like to enter inside a table a cell type of JCombobox that will use these enums values. my problem is to combain between string values and the enum. for example the enum class: enum item_Type {entree, main_Meal, Dessert, Drink} for example the table class: setTitle("Add new item" ); setSize(300, 80); setBackground( Color.gray ); // Create a panel to hold all other components topPanel = new JPanel(); topPanel.setLayout( new BorderLayout() ); getContentPane().add( topPanel ); //new JComboBox(item_Type.values()); JComboBox aaa = new JComboBox(); aaa = new JComboBox(item_Type.values()); TableColumn sportColumn = table.getColumnModel().getColumn(2); // Create columns names String columnNames[] = {"Item Description", "Item Type", "Item Price"}; // Create some data String dataValues[][] = {{ "0", aaa, "0" }}; // Create a new table instance table = new JTable( dataValues, columnNames ); // Add the table to a scrolling pane scrollPane = new JScrollPane( table ); topPanel.add( scrollPane, BorderLayout.CENTER ); I know that at the dataValues array I cant use aaa (the enum jcombobox). How can I do that? thanks in advance.

    Read the article

  • string representation of enum values

    - by robUK
    Hello, gcc 4.4.2 c89 I have the following enum: enum drop_options_e { drop_ssm, drop_snm, drop_ssb }; I am just wondering that is the best way to get the string representation value from the enum. So basically, instead of returning the value of 0 for drop_ssm, I could get the 'drop_ssm' instead. Many thanks for any advice,

    Read the article

  • Data bind enum properties to grid and display description

    - by TrueWill
    This is a similar question to How to bind a custom Enum description to a DataGrid, but in my case I have multiple properties. public enum ExpectationResult { [Description("-")] NoExpectation, [Description("Passed")] Pass, [Description("FAILED")] Fail } public class TestResult { public string TestDescription { get; set; } public ExpectationResult RequiredExpectationResult { get; set; } public ExpectationResult NonRequiredExpectationResult { get; set; } } I'm binding a BindingList<TestResult> to a WinForms DataGridView (actually a DevExpress.XtraGrid.GridControl, but a generic solution would be more widely applicable). I want the descriptions to appear rather than the enum names. How can I accomplish this? (There are no constraints on the class/enum/attributes; I can change them at will.)

    Read the article

  • Entity Framework 5 Enum Naming

    - by Tyrel Van Niekerk
    I am using EF 5 with migrations and code first. It all works rather nicely, but there are some issues/questions I would like to resolve. Let's start with a simple example. Lets say I have a User table and a user type table. The user type table is an enum/lookup table in my app. So the user table has a UserTypeId column and a foreign key ref etc to UserType. In my poco, I have a property called UserType which has the enum type. To add the initial values to the UserType table (or add/change values later) and to create the table in the initial migrator etc. I need a UserType table poco to represent the actual table in the database and to use in the map files. I mapped the UserType property in the User poco to UserTypeId in the UserType poco. So now I have a poco for code first/migrations/context mapping etc and I have an enum. Can't have the same name for both, so do I have a poco called UserType and something else for the enum or have the poco for UserType be UserTypeTable or something? More importantly however, am I missing some key element in how code first works? I tried the example above, ran Add-Migration and it does not add the lookup table for the enum.

    Read the article

  • C# Test if an object is an Enum

    - by Aran Mulholland
    I would like to know if 'theObject' is an enum (of any enum type) foreach (var item in Enum.GetValues(theObject.GetType())) { //make sure we have all the enumeration values in the collection if (this.ValuesCollection.Contains(item)) { } else { this.ValuesCollection.Add(item); } Console.WriteLine(item.ToString()); Console.WriteLine(item.GetType().ToString()); }

    Read the article

  • How to store enum values in a NSMutableArray

    - by Oysio
    My problem is since an enum in objective-c essentially is an int value, I am not able to store it in a NSMutableArray. Apparently NSMutableArray won't take any c-date types like an int. Is there any common way to achieve this ? typedef enum { green, blue, red } MyColors; NSMutableArray *list = [[NSMutableArray alloc] initWithObjects: green, blue, red, nil]; //Get enum value back out MyColors greenColor = [list objectAtIndex:0];

    Read the article

  • Creating an enum/class from a Database Table

    - by Mark
    I have a database table that essentially contains different types of things. I'll use animals as an example. I have a table called AnimalTypes: AnimalTypes { ID:int, Name:string } I then populate it with: 1:Dog, 2:Cat, 3:Fish I would like to then have some sort of C# object created that functions similar to this enum be entirely read from the database: enum AnimalTypes { Dog = 1, Cat = 2, Fish = 3 } Is there a way to create an enum/class from a database table as described? I basically want to be able to reference things in the AnimalTypes table using intellisense and AnimalTypes.Dog as an example; I don't actually need an enum, just something that kind of functions like one. Is this possible? Edit: I'm not really that thrilled about generating a DLL as I've seen in other related problems. I feel like this should be possible with reflection.

    Read the article

  • Convert object to enum C#

    - by Shawn Mclean
    I have binded a list of enum to a combobox. Now I want to get the SelectedItem return the enum, which currently returns it as type object. How do I convert this object to my enum? My framework is silverlight on windows-phone-7

    Read the article

  • How to change enum definition without impacting clients using it in C#

    - by Rohit
    I have the following enum defined. I have used underscores as this enum is used in logging and i don't want to incur the overhead of reflection by using custom attribute.We use very heavy logging. Now requirement is to change "LoginFailed_InvalidAttempt1" to "LoginFailed Attempt1". If i change this enum, i will have to change its value across application. I can replace underscore by a space inside logging SP. Is there any way by which i can change this without affecting whole application.Please suggest. public enum ActionType { None, Created, Modified, Activated, Inactivated, Deleted, Login, Logout, ChangePassword, ResetPassword, InvalidPassword, LoginFailed_LockedAccount, LoginFailed_InActiveAccount, LoginFailed_ExpiredAccount, ForgotPassword, LoginFailed_LockedAccount_InvalidAttempts, LoginFailed_InvalidAttempt1, LoginFailed_InvalidAttempt2, LoginFailed_InvalidAttempt3, ForgotPassword_InvalidAttempt1, ForgotPassword_InvalidAttempt2, ForgotPassword_InvalidAttempt3, SessionTimeOut, ForgotPassword_LockedAccount, LockedAccount, ReLogin, ChangePassword_Due_To_Expiration, ChangePassword_AutoExpired }

    Read the article

  • Declare java enum with a String array

    - by chama
    I'm trying to declare an enum type based on data that I'm retrieving from a database. I have a method that returns a string array of all the rows in the table that I want to make into an enumerated type. Is there any way to construct an enum with an array? This is what I tried, but from the way it looked in eclipse, it seemed like this just created a method by that name: public enum ConditionCodes{ Condition.getDescriptions(); } Thank you in advance!

    Read the article

  • Assign enum property in xaml using silverlight

    - by Malcolm
    I have a property of datattype enum : like public BreakLevel Level { get { return level; } set { level = value; } } And enum defined : public enum BreakLevel { Warning, Fatal } I want bind the neum property to the visibility of my border , somewhat like this: Visibility="{Binding BreakLevel.Fatal}" so is it possible? <Border CornerRadius="4" BorderThickness="1" BorderBrush="#DAE0E5" Visibility="{Binding DataContext.IsError, Converter={StaticResource BoolToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}" >

    Read the article

  • Best way to create a Unique ID field for an enum

    - by jax
    What is the best way to get a Unique ID from an ENUM that will stay consistent between repeated execution of the program? Currently I am doing this manually by passing an ID to the enum constructor. I don't really want to do this is I can help it. Another option would be to use a static field that gets incremented for each enum value. The problem is that if later I decide to move the enum fields around or delete some this will cause problems with my program as the ID will be saved into user preferences. The ID can be any basic type or a String.

    Read the article

  • 64 bit enum in C++?

    - by Rob
    Is there a way to have a 64 bit enum in C++? Whilst refactoring some code I came across bunch of #defines which would be better as an enum, but being greater than 32 bit causes the compiler to error. For some reason I thought the following might work: enum MY_ENUM : unsigned __int64 { LARGE_VALUE = 0x1000000000000000, };

    Read the article

  • How do you pass an enum by reference?

    - by Darkenor
    I have an enum with four keys I'm taking as input for an interface program and I'd like to pass the enum by value to the interface function, which has become quite long. The enum is like this: enum MYKEYS { W, S, O, L }; There's also a boolean array that I have to pass by reference, which is also a little tricky. bool key[4] = { false, false, false, false }; Does anyone know the proper syntax to pass both of these as reference in a function, similar to: function(int & anintreference);

    Read the article

  • AutoMapper strings to enum descriptions

    - by 6footunder
    Given the requirement: Take an object graph, set all enum type properties based on the processed value of a second string property. Convention dictates that the name of the source string property will be that of the enum property with a postfix of "Raw". By processed we mean we'll need to strip specified characters e.t.c. I've looked at custom formatters, value resolvers and type converters, none of which seems like a solution for this? We want to use AutoMapper as opposed to our own reflection routine for two reasons, a) it's used extensively throughout the rest of the project and b) it gives you recursive traversal ootb. -- Example -- Given the (simple) structure below, and this: var tmp = new SimpleClass { CountryRaw = "United States", Person = new Person { GenderRaw="Male" } }; var tmp2 = new SimpleClass(); Mapper.Map(tmp, tmp2); we'd expect tmp2's MappedCountry enum to be Country.UnitedStates and the Person property to have a gender of Gender.Male. public class SimpleClass1 { public string CountryRaw {get;set;} public Country MappedCountry {get;set;} public Person Person {get;set;} } public class Person { public string GenderRaw {get;set;} public Gender Gender {get;set;} public string Surname {get;set;} } public enum Country { UnitedStates = 1, NewZealand = 2 } public enum Gender { Male, Female, Unknown } Thanks

    Read the article

  • OpenSSL x509 Purpose flag "Any Purpose" What is this?

    - by Nick
    Looking at the details of a certificate using the following: openssl x509 -noout -text -purpose -in mycert.pem I find a bunch of purpose flags (which I've discovered are set by the various extensions attached to a certificate). One of these purpose flags is "Any Purpose". I can't seem to find ANY documentation on this flag and why or why not it is set. Do any of you know where I can find more information on this purpose and what it means? Thanks,

    Read the article

  • OpenSSL x509 Purpose flag "Any Purpose" What is this?

    - by Nick
    Looking at the details of a certificate using the following: openssl x509 -noout -text -purpose -in mycert.pem I find a bunch of purpose flags (which I've discovered are set by the various extensions attached to a certificate). One of these purpose flags is "Any Purpose". I can't seem to find ANY documentation on this flag and why or why not it is set. Do any of you know where I can find more information on this purpose and what it means? Thanks,

    Read the article

  • Trace Flag 610 – When should you use it?

    - by simonsabin
    Thanks to Marcel van der Holst for providing this great information on the use of Trace Flag 610. This trace flag can be used to have minimal logging into a b tree (i.e. clustered table or an index on a heap) that already has data. It is a trace flag because in testing they found some scenarios where it didn’t perform as well. Marcel explains why below. “ TF610 can be used to get minimal logging in a non-empty B-Tree. The idea is that when you insert a large amount of data, you don't want to...(read more)

    Read the article

  • SQL Server 2008 R2 still requires a trace flag for Lock Pages in Memory

    - by AaronBertrand
    Almost two years ago, I blogged that Lock Pages in Memory was finally available to Standard Edition customers (Enterprise Edition customers had long been deemed smart enough to not abuse this feature). In addition to applying a cumulative update (2005 SP3 CU4 or 2008 SP1 CU2), in order to take advantage of LPIM, you also had to enable trace flag 845. Since the trace flag isn't documented for SQL Server 2008 R2, several of us in the community assumed that it was no longer required (since it was introduced...(read more)

    Read the article

  • Problem setting output flags for ALU in "Nand to Tetris" course

    - by MahlerFive
    Although I tagged this homework, it is actually for a course which I am doing on my own for free. Anyway, the course is called "From Nand to Tetris" and I'm hoping someone here has seen or taken the course so I can get some help. I am at the stage where I am building the ALU with the supplied hdl language. My problem is that I can't get my chip to compile properly. I am getting errors when I try to set the output flags for the ALU. I believe the problem is that I can't subscript any intermediate variable, since when I just try setting the flags to true or false based on some random variable (say an input flag), I do not get the errors. I know the problem is not with the chips I am trying to use since I am using all builtin chips. Here is my ALU chip so far: /** * The ALU. Computes a pre-defined set of functions out = f(x,y) * where x and y are two 16-bit inputs. The function f is selected * by a set of 6 control bits denoted zx, nx, zy, ny, f, no. * The ALU operation can be described using the following pseudocode: * if zx=1 set x = 0 // 16-bit zero constant * if nx=1 set x = !x // Bit-wise negation * if zy=1 set y = 0 // 16-bit zero constant * if ny=1 set y = !y // Bit-wise negation * if f=1 set out = x + y // Integer 2's complement addition * else set out = x & y // Bit-wise And * if no=1 set out = !out // Bit-wise negation * * In addition to computing out, the ALU computes two 1-bit outputs: * if out=0 set zr = 1 else zr = 0 // 16-bit equality comparison * if out<0 set ng = 1 else ng = 0 // 2's complement comparison */ CHIP ALU { IN // 16-bit inputs: x[16], y[16], // Control bits: zx, // Zero the x input nx, // Negate the x input zy, // Zero the y input ny, // Negate the y input f, // Function code: 1 for add, 0 for and no; // Negate the out output OUT // 16-bit output out[16], // ALU output flags zr, // 1 if out=0, 0 otherwise ng; // 1 if out<0, 0 otherwise PARTS: // Zero the x input Mux16( a=x, b=false, sel=zx, out=x2 ); // Zero the y input Mux16( a=y, b=false, sel=zy, out=y2 ); // Negate the x input Not16( in=x, out=notx ); Mux16( a=x, b=notx, sel=nx, out=x3 ); // Negate the y input Not16( in=y, out=noty ); Mux16( a=y, b=noty, sel=ny, out=y3 ); // Perform f Add16( a=x3, b=y3, out=addout ); And16( a=x3, b=y3, out=andout ); Mux16( a=andout, b=addout, sel=f, out=preout ); // Negate the output Not16( in=preout, out=notpreout ); Mux16( a=preout, b=notpreout, sel=no, out=out ); // zr flag Or8way( in=out[0..7], out=zr1 ); // PROBLEM SHOWS UP HERE Or8way( in=out[8..15], out=zr2 ); Or( a=zr1, b=zr2, out=zr ); // ng flag Not( in=out[15], out=ng ); } So the problem shows up when I am trying to send a subscripted version of 'out' to the Or8Way chip. I've tried using a different variable than 'out', but with the same problem. Then I read that you are not able to subscript intermediate variables. I thought maybe if I sent the intermediate variable to some other chip, and that chip subscripted it, it would solve the problem, but it has the same error. Unfortunately I just can't think of a way to set the zr and ng flags without subscripting some intermediate variable, so I'm really stuck! Just so you know, if I replace the problematic lines with the following, it will compile (but not give the right results since I'm just using some random input): // zr flag Not( in=zx, out=zr ); // ng flag Not( in=zx, out=ng ); Anyone have any ideas? Edit: Here is the appendix of the book for the course which specifies how the hdl works. Specifically look at section 5 which talks about buses and says: "An internal pin (like v above) may not be subscripted". Edit: Here is the exact error I get: "Line 68, Can't connect gate's output pin to part". The error message is sort of confusing though, since that does not seem to be the actual problem. If I just replace "Or8way( in=out[0..7], out=zr1 );" with "Or8way( in=false, out=zr1 );" it will not generate this error, which is what lead me to look up in the appendix and find that the out variable, since it was derived as intermediate, could not be subscripted.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >