Search Results

Search found 13563 results on 543 pages for 'condition variable'.

Page 12/543 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Add Or Condition to Entity in Entity Framework

    - by Blakewell
    Can you add an "Or" condition to an entity in the entity framework? For example something like: Property1 == (1 or 2 or 3) The message I get when putting the value of "1 || 2 || 3" or "1,2,3" or "1 or 2 or 3" returns this message: condition is not compatible with the type of the member

    Read the article

  • Django: remove a filter condition from a queryset

    - by Don
    I have a third-part funtion which gives me a filtered queryset (e.g. records with 'valid'=True) but I want to remove a particular condition (e.g. to have all records, both valid and invalid). Is there a way to remove a filter condition to an already-filtered queryset? E.g. only_valid = MyModel.objects.filter(valid=True) all_records = only_valid.**remove_filter**('valid') (I know that it would be better to define 'all_records' before 'only_valid', but this is just an example...)

    Read the article

  • MSBuild CreateItem condition include based on config file

    - by Mac
    I'm trying to select a list of test dlls that contain corresponding config files MyTest.Tests.dll MyTest.Tests.config I have to use a createItem as the dlls are not available at the time of the script loading <CreateItem Include="$(AssemblyFolder)\*.Tests.dll" Condition="???" <Output TaskParameter="Include" ItemName="TestBinariesWithConfig"/> </CreateItem> Is there a condition I can use or is this the wrong approach? Thanks Mac

    Read the article

  • Alter stored procedure if condition is met

    - by Matt
    I am looking to alter a stored procedure if a condition exists. I want to leave the stored procedure as is if the condition is not met, so drop/create is not really an option. Trying to put the contents of ALTER PROC inside an IF block is throwing up errors for me. Any thoughts?

    Read the article

  • How to disable the delete button using if condition in Extjs

    - by sample
    How to disable the delete button using if condition in Extjs for ex;i want to disable the button if it satifies the given if condition else remain enabled. if(validAction(entityHash.get('entity.xyz'),actionHash.get('action.delete'))) This is the grid Delete button code. Ext.reg("gridheaderbar-inActive", Ad.GridInActiveButton,{ xtype: 'tbspacer', width: 5 }); Ad.GridCampDeleteButton = Ext.extend(Ext.Toolbar.Button, { //text: 'Delete', cls: 'ad-img-button', width:61, height:40, iconCls: 'ad-btn-icon', icon: '/webapp/resources/images/btn_del.png', handler:function(){ statusChange(this.parentBar.parentGrid, 'Delete') } });

    Read the article

  • wired problem about wix condition message

    - by Dafan
    the following is my code i want to change the value of "ODPNETINSTALLED" in custom action "SetProperty" so i expect the condition message will not pop up. but it shows every time at the first beginning of install. who can tell me why? i also make the following change: Then the condition message shows after accept licence agreement. please help me out there!!! ----------

    Read the article

  • Who knows the value of global variables in the qt qtscript script to access the global variable to change the global variable value; [closed]

    - by dawntrees
    Who knows the value of global variables in the qt qtscript script to access the global variable to change the global variable value; forexample int gVar=0; int main(int argc, char *argv[]) { QScriptEngine engine; QScriptValue varValue = m_engine-newVariant(gVar); engine.globalObject().setProperty("gVar", varValue); QScriptValue result = m_engine->evaluate("gVar=100;"); qDebug()<<"gVar================"<<gVar; return 0; } Why gVar = 0 and not equal to 100; how can we make gVar equal to 100(gVar=100) Who can help group I appreciate it, thanks!

    Read the article

  • Inherit one instance variable from the global scope

    - by Julian
    I'm using Curses to create a command line GUI with Ruby. Everything's going well, but I have hit a slight snag. I don't think Curses knowledge (esoteric to be fair) is required to answer this question, just Ruby concepts such as objects and inheritance. I'm going to explain my problem now, but if I'm banging on, just look at the example below. Basically, every Window instance needs to have .close called on it in order to close it. Some Window instances have other Windows associated with it. When closing a Window instance, I want to be able to close all of the other Window instances associated with it at the same time. Because associated Windows are generated in a logical fashion, (I append the name with a number: instance_variable_set(self + integer, Window.new(10,10,10,10)) ), it's easy to target generated windows, because methods can anticipate what assosiated windows will be called, (I can recreate the instance variable name from scratch, and almost query it: instance_variable_get(self + integer). I have a delete method that handles this. If the delete method is just a normal, global method (called like this: delete_window(@win543) then everything works perfectly. However, if the delete method is an instance method, which it needs to be in-order to use the self keyword, it doesn't work for a very clear reason; it can 'query' the correct instance variable perfectly well (instance_variable_get(self + integer)), however, because it's an instance method, the global instances aren't scoped to it! Now, one way around this would obviously be to simply make a global method like this: delete_window(@win543). But I have attributes associated with my window instances, and it all works very elegantly. This is very simplified, but it literally translates the problem exactly: class Dog def speak woof end end def woof if @dog_generic == nil puts "@dog_generic isn't scoped when .woof is called from a class method!\n" else puts "@dog_generic is scoped when .woof is called from the global scope. See:\n" + @dog_generic end end @dog_generic = "Woof!" lassie = Dog.new lassie.speak #=> @dog_generic isn't scoped when .woof is called from an instance method!\n woof #=> @dog_generic is scoped when .woof is called from the global scope. See:\nWoof! TL/DR: I need lassie.speak to return this string: "@dog_generic is scoped when .woof is called from the global scope. See:\nWoof!" @dog_generic must remain as an insance variable. The use of Globals or Constants is not acceptable. Could woof inherit from the Global scope? Maybe some sort of keyword: def woof < global # This 'code' is just to conceptualise what I want to do, don't take offence! end Is there some way the .woof method could 'pull in' @dog_generic from the global scope? Will @dog_generic have to be passed in as a parameter?

    Read the article

  • Creating a new variable versus assigning an existing one

    - by rwallace
    Which is more common, creating a new variable versus assigning an existing variable (field, array element etc - anything that syntactically uses the assignment operator)? The reason I ask is that I'm designing a new language, and wondering which of these two operations should get the shorter syntax. It's not intended to be a pure functional language, or the question wouldn't arise, so I'd ideally like to count usage across large existing code bases in procedural and object-oriented languages like C, C++ and Java, though as far as I can see there isn't an easy way to do this automatically, and going by memory and eyeball, neither is obviously more common than the other.

    Read the article

  • how to read the password from variable?

    - by Viswa
    I am trying to move my file to another system which is located in some other place, with this command: rsync -avrz src destination It works fine. But what I need is to put this command in shell script and run it like: #! /bin/sh rsync -avrz srcfilelocation destination When it runs, it asks for the destination system password. I know that password and give it manually. Now I have decided to assign the password to an environment variable, like pswd="destination system password". I need my shell script to read the password from this variable. How can I write a script to do this?

    Read the article

  • Compare a variable that can have numeric or string as value

    - by Tarun
    I have a variable named Seconds_Behind_Master from one of my scripts. The problem is that this variable can either have a numeric value or can also take a string NULL as its value. Now, when I try to execute this script in shell it gets executed but gives a warning like this: [: Illegal number: NULL I believe it is due to the fact that in this case the value is NULL but when it compares it with numeral value 60 it gives this warning. How can I rectify it? Here is the piece of code: Seconds_Behind_Master=$Show_Slave_Status | grep "Seconds_Behind_Master" | awk -F": " {' print $2 '} if [ "$Seconds_Behind_Master" -ge "60" ]; then echo "replication delayed greater than or equal to 60." else if [ "$Seconds_Behind_Master" = "NULL" ]; then echo "Delay is Null." fi fi

    Read the article

  • Global variable in a Linux shared library

    - by user3730495
    Suppose we have the following setup under Linux, .so library named "libcnt.so" and 3 user space apps: "app1", "app2", "app3". This library does 1 simple thing, it says to the app (app dynamically links the library at runtime) by how many apps it is already linked. Apps should have access to link counter. My knowledge in C and Linux is somewhat limited in this aspect, but as I understand this information should be stored in a global variable inside the shared object. Something like: in libcnt.h extern int cnt_loads; in libcnt.c int cnt_loads = 0; // where each linking increments this counter or something... So, my question is how it should be declared and/or defined inside .so library to guaranty that multiple apps from user space get the same instance of that variable counter?

    Read the article

  • In C++, what is the scope resolution ("order of precedence") for shadowed variable names?

    - by Emile Cormier
    In C++, what is the scope resolution ("order of precedence") for shadowed variable names? I can't seem to find a concise answer online. For example: #include <iostream> int shadowed = 1; struct Foo { Foo() : shadowed(2) {} void bar(int shadowed = 3) { std::cout << shadowed << std::endl; // What does this output? { int shadowed = 4; std::cout << shadowed << std::endl; // What does this output? } } int shadowed; }; int main() { Foo().bar(); } I can't think of any other scopes where a variable might conflict. Please let me know if I missed one. What is the order of priority for all four shadow variables when inside the bar member function?

    Read the article

  • PHP - How do you secure a unique variable name?

    - by 102319141763223461745
    This function cropit, which I shamelessly stole off the internet, crops a 90x60 area from an existing image. In this code, when I use the function for more than one item (image) the one will display on top of the other (they come to occupy the same output space). I think this is because the function has the same (static) name ($dest) for the destination of the image when it's created (imagecopy). I tried, as you can see to include a second argument to the cropit function which would serve as the "name" of the $dest variable, but it didn't work. In the interest of full disclosure I have 22 hours of PHP experience (incidentally the same number of hours since the last I slept) and I am not that smart to begin with. Even if there's something else at work here entirely, seems to me that generally it must be useful to have a way to secure that a variable is always given a unique name. function cropit($srcimg, $dest) { $im = imagecreatefromjpeg($srcimg); $img_width = imagesx($im); $img_height = imagesy($im); $width = 90; $height = 60; $tlx = floor($img_width / 2) - floor ($width / 2); $tly = floor($img_height / 2) - floor ($height / 2); if ($tlx < 0) { $tlx = 0; } if ($tly < 0) { $tly = 0; } if (($img_width - $tlx) < $width) { $width = $img_width - $tlx; } if (($img_height - $tly) < $height) { $height = $img_height - $tly; } $dest = imagecreatetruecolor ($width, $height); imagecopy($dest, $im, 0, 0, $tlx, $tly, $width, $height); imagejpeg($dest); imagedestroy($dest); } $img = "imagefolder\imageone.jpg"; $img2 = "imagefolder\imagetwo.jpg"; cropit($img, $i1); cropit($img2, $i2); ?

    Read the article

  • Assigning a 2D array (of pointers) to a variable in an object for access in C++?

    - by MrMormon
    I'm sorry if I didn't pick a descriptive or concise name. A lot of questions sound similar, but I haven't been able to find what I'm looking for. What I want to do is store a 2D array of pointers somewhere and assign a variable in some object to that array to be able to access it. Here's some example code that has the same compile error I'm getting with a bigger project. #include <iostream> using namespace std; struct X{ float * b[8][8]; X(){ *(b[1][5]) = 1; cout << *(b[1][5]) << endl; } void Set(float * c[8][8]){ b = c; cout << *(b[1][5]) << endl; } }; main(){ float * a[8][8]; *(a[1][5]) = 2; X obj; obj.Set(a); } What I want to happen in this code is that an X object starts with its own 2D array, whose value pointed to by b[1][5] should be printed as "1". Then the main method's 2D array, a, is passed to the object's Set() method and assigned to its array variable. The value pointed to by b[1][5] should then be printed as "2". However, I can't figure out what type the Set() parameter, c, should be. I get error: incompatible types in assignment of ‘float* (*)[8]’ to ‘float* [8][8]’ when I try to compile. As for why I want to do this, I'm trying to use an array of pointers to objects, not floats, but it's the same error.

    Read the article

  • Why doesn't my environment variable get set?

    - by reprogrammer
    I have to set an environment variable called GDK_NATIVE_WINDOWS to fix the problem with Eclipse buttons in Ubuntu. To set the environment variable, I added the following line to ~/.pam_environment. GDK_NATIVE_WINDOWS DEFAULT=true Surprisingly, the environment variable doesn't get set when I echo $GDK_NATIVE_WINDOWS in a terminal. However, all other environment variables that I've listed in ~/.pam_environment are set properly. Besides, when I switch to a tty, e.g. Alt+Ctrl+F1, the environment variable gets set correctly. Can anyone tell what's wrong with setting this environment variable in ~/.pam_environment?

    Read the article

  • Caching of path environment variable on windows?

    - by jwir3
    I'm assisting one of our testers in troubleshooting a configuration problem on a Windows XP SP3 system. Our application uses an environment variable, called APP_HOME, to refer to the directory where our application is installed. When the application is installed, we utilize the following environment variables: APP_HOME = C:\application\ PATH = %PATH%;%APP_HOME%bin Now, the problem comes in that she's working with multiple versions of the same application. So, in order to switch between version 7.0 and 8.1, for example, she might use: APP_HOME = C:\application_7.0\ (for 7.0) and then change it to: APP_HOME = C:\application_8.1\ (for 8.1) The problem is that once this change is made, the PATH environment variable apparently still is looking at the old expansion of the APP_HOME variable. So, for example, after she has changed APP_HOME, PATH still refers to the 7.0 bin directory. Any thoughts on why this might be happening? It looks to me like the PATH variable is caching the expansion of the APP_HOME environment variable. Is there any way to turn this behavior off?

    Read the article

  • Why doesn't my environment variable get set?

    - by reprogrammer
    I have to set an environment variable called GDK_NATIVE_WINDOWS to fix the problem with Eclipse buttons in Ubuntu. To set the environment variable, I added the following line to ~/.pam_environment. GDK_NATIVE_WINDOWS DEFAULT=true Surprisingly, the environment variable doesn't get set when I echo $GDK_NATIVE_WINDOWS in a terminal. However, all other environment variables that I've listed in ~/.pam_environment are set properly. Besides, when I switch to a tty, e.g. Alt+Ctrl+F1, the environment variable gets set correctly. Can anyone tell what's wrong with setting this environment variable in ~/.pam_environment?

    Read the article

  • Entity Framework - Condition on one to many join (Lambda)

    - by nirpi
    Hi, I have 2 entities: Customer & Account, where a customer can have multiple accounts. On the account, I have a "PlatformTypeId" field, which I need to condition on (multiple values), among other criterions. I'm using Lambda expressions, to build the query. Here's a snippet: var customerQuery = (from c in context.CustomerSet.Include("Accounts") select c); if (criterions.UserTypes != null && criterions.UserTypes.Count() > 0) { List<short> searchCriterionsUserTypes = criterions.UserTypes.Select(i => (short)i).ToList(); customerQuery = customerQuery.Where(CommonDataObjects.LinqTools.BuildContainsExpression<Customer, short>(c => c.UserTypeId, searchCriterionsUserTypes)); } // Other criterions, including the problematic platforms condition (below) var customers = customerQuery.ToList(); I can't figure out how to build the accounts' platforms condition: if (criterions.Platforms != null && criterions.Platforms.Count() > 0) { List<short> searchCriterionsPlatforms = criterions.Platforms.Select(i => (short)i).ToList(); customerQuery = customerQuery.Where(c => c.Accounts.Where(LinqTools.BuildContainsExpression<Account, short>(a => a.PlatformTypeId, searchCriterionsPlatforms))); } (The BuildContainsExpression is a method we use to build the expression for the multi-select) I'm getting a compilation error: The type arguments for method 'System.Linq.Enumerable.Where(System.Collections.Generic.IEnumerable, System.Func)' cannot be inferred from the usage. Try specifying the type arguments explicitly. Any idea how to fix this? Thanks, Nir.

    Read the article

  • Flex ChangeWatcher bind to a negative condition

    - by bedwyr
    I have a bindable getter in a component which informs me when a [hidden] timer is running. I also have a context menu which, if this timer is running, should disable one of the menu items. Is it possible to create a ChangeWatcher which watches for the negative condition of a bindable property/getter and changes the enabled property of the menu item? Here are the basic methods I'm trying to bind together: Class A: [Bindable] public function get isPlaying():Boolean { return (_timer != null) ? _timer.running : false; } Class B: private var _playingWatcher:ChangeWatcher; public function createContextMenu():void { //...blah blah, creating context menu var newItem:ContextMenuItem = new ContextMenuItem(); _playingWatcher = BindingUtils.bindProperty(newItem, "enabled", _classA, "isPlaying"); } In the code above, I have the inverse case: when isPlaying() is true, the menu item is enabled; I want it to only be enabled when the condition is false. I could create a second getter (there are other bindings which rely on the current getter) to return the inverse condition, but that sounds ugly to me: [Bindable] public function get isNotPlaying():Boolean { return !isPlaying; } Is this possible, or is there another approach I'm completely missing?

    Read the article

  • How to reload a tableView i.e call the viewDidLoad method if a condition is met

    - by Kquane Ingram
    The problem is this i need a way to basically erase all the entry data a user placed into my arrays if a condition is met. Im new to Objective-C and iOS programming, but i believed the solution might be in calling the viewDidLoad method, thus it would virtually refresh the applications with the values of the array reset to default. If there is any other logical way of doing this i would appreciate the help. In short i need to refresh the arrays as they were when the application first launched and the user did not select anything. This is the part where i need it to refresh. if ([gradeRecieved objectAtIndex:i]==nil) { break; // if this condition is met the program must begin anew. Edit* I need to recall the - (void)viewDidLoad method here is more of the code. -(IBAction)button:(id)sender{ int i = 0; int sum = 0; int gradeEarned; int creditHours = 3; for ( i=0;i<8 ; i++) { if ([[points objectAtIndex:i] tag]==GradeA.intValue) { [gradeRecieved replaceObjectAtIndex:i withObject:GradeA]; } if ([[points objectAtIndex:i]tag]==GradeB.intValue) { [gradeRecieved replaceObjectAtIndex:i withObject:GradeB]; } if ([[points objectAtIndex:i]tag]==GradeC.intValue){ [gradeRecieved replaceObjectAtIndex:i withObject:GradeC]; } if ([gradeRecieved objectAtIndex:i]==nil) { break; // if this condition is met the program must restart. } } while ( i<[gradeRecieved count]) { if ([gradeRecieved objectAtIndex:i] == GradeA ) { [finArray replaceObjectAtIndex:i withObject:GradeA]; i++; continue; } if ([gradeRecieved objectAtIndex:i] == GradeB ) { [gradeRecieved replaceObjectAtIndex:i withObject:GradeB]; i++; continue; } if ([gradeRecieved objectAtIndex:i] == GradeC ) { [gradeRecieved replaceObjectAtIndex:i withObject:GradeC]; i++; continue; } }

    Read the article

  • LINQ - 'Could not translate expression' with previously used and proven query condition

    - by tomfumb
    I am fairly new to LINQ and can't get my head around some inconsistency in behaviour. Any knowledgeable input would be much appreciated. I see similar issues on SO and elsewhere but they don't seem to help. I have a very simple setup - a company table and an addresses table. Each company can have 0 or more addresses, and if 0 one must be specified as the main address. I'm trying to handle the cases where there are 0 addresses, using an outer join and altering the select statement accordingly. Please note I'm currently binding the output straight to a GridView so I would like to keep all processing within the query. The following DOES work IQueryable query = from comp in context.Companies join addr in context.Addresses on comp.CompanyID equals addr.CompanyID into outer // outer join companies to addresses table to include companies with no address from addr in outer.DefaultIfEmpty() where (addr.IsMain == null ? true : addr.IsMain) == true // if a company has no address ensure it is not ruled out by the IsMain condition - default to true if null select new { comp.CompanyID, comp.Name, AddressID = (addr.AddressID == null ? -1 : addr.AddressID), // use -1 to represent a company that has no addresses MainAddress = String.Format("{0}, {1}, {2} {3} ({4})", addr.Address1, addr.City, addr.Region, addr.PostalCode, addr.Country) }; but this displays an empty address in the GridView as ", , ()" So I updated the MainAddress field to be MainAddress = (addr.AddressID == null ? "" : String.Format("{0}, {1}, {2} {3} ({4})", addr.Address1, addr.City, addr.Region, addr.PostalCode, addr.Country)) and now I'm getting the Could not translate expression error and a bunch of spewey auto-generated code in the error which means very little to me. The condition I added to MainAddress is no different to the working condition on AddressID, so can anybody tell me what's going on here? Any help greatly appreciated.

    Read the article

  • How to linebreak long string constructs ?

    - by iFloh
    I am editing SQLite SQL statements of substantial length. How can I break these into several lines to allow comfortablt editing? const char *sql = "SELECT arguments arguments arguments arguments arguments arguments arguments arguments arguments arguments FROM a, b, WHERE condition condition condition condition condition condition condition" into const char *sql = "SELECT arguments arguments arguments arguments arguments arguments arguments arguments arguments arguments FROM a, b WHERE condition condition condition" cheers

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >