Search Results

Search found 3096 results on 124 pages for 'scope creep'.

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

  • InvalidOperationException (Lambda parameter not in scope) when trying to Compile a Lambda Expression

    - by Moshe Levi
    Hello, I'm writing an Expression Parser to make my API more refactor friendly and less error prone. basicaly, I want the user to write code like that: repository.Get(entity => entity.Id == 10); instead of: repository.Get<Entity>("Id", 10); Extracting the member name from the left side of the binary expression was straight forward. The problems began when I tried to extract the value from the right side of the expression. The above snippet demonstrates the simplest possible case which involves a constant value but it can be much more complex involving closures and what not. After playing with that for some time I gave up on trying to cover all the possible cases myself and decided to use the framework to do all the heavy lifting for me by compiling and executing the right side of the expression. the relevant part of the code looks like that: public static KeyValuePair<string, object> Parse<T>(Expression<Func<T, bool>> expression) { var binaryExpression = (BinaryExpression)expression.Body; string memberName = ParseMemberName(binaryExpression.Left); object value = ParseValue(binaryExpression.Right); return new KeyValuePair<string, object>(memberName, value); } private static object ParseValue(Expression expression) { Expression conversionExpression = Expression.Convert(expression, typeof(object)); var lambdaExpression = Expression.Lambda<Func<object>>(conversionExpression); Func<object> accessor = lambdaExpression.Compile(); return accessor(); } Now, I get an InvalidOperationException (Lambda parameter not in scope) in the Compile line. when I googled for the solution I came up with similar questions that involved building an expression by hand and not supplying all the pieces, or trying to rely on parameters having the same name and not the same reference. I don't think that this is the case here because I'm reusing the given expression. I would appreciate if someone will give me some pointers on this. Thank you.

    Read the article

  • Object not declared in scope

    - by jay
    I'm using Xcode for C++ on my computer while using Visual Studio at school. The following code worked just fine in Visual Studio, but I'm having this problem when using Xcode. clock c1(2, 3, 30); Everything works just fine, but it keeps giving me this error that says "Expected ';' before 'c1'" Fine, I put the ';' .. but then, it gives me this error: "'c1' was not declared in this scope" Here's the whole header code: #include <iostream> using namespace std; class clock { private: int h; int m; int s; public: clock(int hr, int mn, int sec); }; clock::clock(int hr, int mn, int sec) { h = hr; m = mn; s = sec; } Here's the whole .cpp code: #include "clock.h" int main() { clock c1(2, 3, 30); return 0; } I stripped everything down to where I had the problem. Everything else, as far as I know, is irrelevant since the problem remains the same with just the mentioned above. Thanks in advance!

    Read the article

  • javascript setTimeout function out of scope.

    - by Keyo
    I am trying to call showUpload(); from within two setTimeouts. Neither works. It seems to be out of scope and I'm not sure why. I tried this.showUpload() which didn't work either. $(document).ready(function(){ var progress_key = $('#progress_key').val(); // this sets up the progress bar $('#uploadform').submit(function() { setTimeout("showUpload()",1500); $("#progressbar").progressbar({ value:0}).fadeIn(); }); // uses ajax to poll the uploadprogress.php page with the id // deserializes the json string, and computes the percentage (integer) // update the jQuery progress bar // sets a timer for the next poll in 750ms function showUpload() { $.get("/myid/videos/uploadprogress/" + progress_key, function(data) { if (!data) return; var response; eval ("response = " + data); if (!response) return; var percentage = Math.floor(100 * parseInt(response['bytes_uploaded']) / parseInt(response['bytes_total'])); $("#progressbar").progressbar({ value:percentage}) }); setTimeout("showUpload()", 750); } }); Thank you for your time.

    Read the article

  • Stuck on Object scope in Java

    - by ivor
    Hello, I'm working my way through an exercise to understand Java, and basically I need to merge the functionality of two classes into one app. I'm stuck on one area though - the referencing of objects across classes. What I have done is set up a gui in one class (test1), and this has a textfield in ie. chatLine = new JTextField(); in another class(test2), I was planning on leaving all the functionality in there and referencing the various gui elements set up in test1 - like this test1.chatLine I understand this level of referencing, I tested this by setting up a test method in the test2 class public static void testpass() { test1.testfield.setText("hello"); } I'm trying to understand how to implement the more complex functionality in test2 class though, specifically this existing code; test1.chatLine.addActionListener(new ActionAdapter() { public void actionPerformed(ActionEvent e) { String s = Game.chatLine.getText(); if (!s.equals("")) { appendToChatBox("OUTGOING: " + s + "\n"); Game.chatLine.selectAll(); // Send the string sendString(s); } } }); This is the bit I'm stuck on, if I should be able to do this - as it's failing on the compile, can I add the actionadapter stuff to the gui element thats sat in test1, but do this from test2 - I'm wondering if I'm trying to do something that's not possible. Hope this makes sense, I'm pretty confused over this - I'm trying to understand how the scope and referencing works. Ideally what i'm trying to achieve is one class that has all the main stuff in, the gui etc, then all the related functionality in the other class, and target the first class's gui elements with the results etc. Any thoughts greatly appreciated.

    Read the article

  • AS3 variables handling by AVM/compiler/scope

    - by jchmielewski
    I have couple of questions about AS3 variables handling by AVM/compiler/scope .1. This code in Flash will throw an error: function myFunction() { var mc:MovieClip=new MovieClip(); var mc:MovieClip=new MovieClip(); } but it won`t throw an error in Flex (only warning in Editor). Why? .2. How Flash sees variables in loops? Apparently this: for (var i:int=0; i<2; i++) { var mc:MovieClip=new MovieClip(); } isn`t equal to just: var mc:MovieClip=new MovieClip(); var mc:MovieClip=new MovieClip(); because it will throw an error again as earlier in Flash, but in Flex in function not? Is Flash changing somehow my loop before compilation? .3. Where in a class in equivalent to timeline in Flash - where in class I would put code which I put normally on timeline (I assume it is not constructor because of what I have written earlier, or maybe it`s a matter of Flash/Flex compiler)?

    Read the article

  • MS Access (Jet) transactions, workspaces & scope

    - by Eric G
    I am having trouble with committing a transaction (using Access 2003 DAO). It's acting as if I never had called BeginTrans -- I get error 3034 on CommitTrans, "You tried to commit or rollback a transaction without first beginning a transaction"; and the changes are written to the database (presumably because they were never wrapped in a transaction). However, BeginTrans is run, if you step through it. I am running it within the Access environment using the DBEngine(0) workspace. The tables I'm updating are all opened via a Jet database connection (to the same database) and updated using DAO.Recordset.update. The connection is opened before starting BeforeTrans. I'm not doing anything weird in the middle of the transaction like closing/opening connections or multiple workspaces etc. There is one nested transaction level (basically it's wrapping multiple transacted updates in an outer transaction, so if any fail they all fail). The inner transactions run without errors, it's the outer transaction that doesn't work. Here are a few things I've looked into and ruled out: The transaction is spread across several methods and BeginTrans and CommitTrans (and Rollback) are all in different places. But when I tried a simple test of running a transaction this way, it doesn't seem like this should matter. I thought maybe the database connection gets closed when it goes out of local scope, even though I have another 'global' reference to it (I'm never sure what DAO does with dbase connections to be honest). But this seems not to be the case -- right before the commit, the connection and its recordsets are alive (I can check their properties, EOF = False, etc.) My CommitTrans and Rollback are done within event callbacks. (Very basically, a parser program is throwing an 'onLoad' or 'onLoadFail' event at the end of parsing, which I am handling by either committing or rolling back the inserts I made during processing.) However, again, trying a simple test, it doesn't seem like this should matter. Any ideas why this isn't working for me? Thanks.

    Read the article

  • php class scope when calling a non-method function not accessing all class members

    - by Aglystas
    So I'm using a stand alone function from within a class that that uses the class it's being called from. Here's the function function catalogProductLink($product_id,$product_name,$categories=true) { //This is the class that the function is called from global $STATE; if ($categories) { //The $STATE->category_id is the property I want to access, which I can't if (is_array($STATE->category_id)) { foreach($STATE->category_id as $cat_id) { if ($cat_id == 0) continue; $str .= "c$cat_id/"; } } } $str .= catalogUrlKeywords($product_name).'-p'.$product_id.'.html'; return $str; } And here's the function call, which is being made from within the $STATE class. $redirect = catalogProductLink($this->product_id, $tempProd->product_name, true, false); The object that I need access to is the $STATE object that has been declared global. Prior to this function call there are lots of public properties populated, but when I look at the $STATE object within the function scope it loses all the properties but one, product_id. The property that matters for this function is the category_id property, which is an array of category id's. I'm wondering why I don't have access to all the public properties of the $STATE object and how I can get access to them.

    Read the article

  • Java reading xml element without prefix but within the scope of a namespace

    - by wsxedc
    Functionally, the two blocks should be the same <soapenv:Body> <ns1:login xmlns:ns1="urn:soap.sof.com"> <userInfo> <username>superuser</username> <password>qapass</password> </userInfo> </ns1:login> </soapenv:Body> ----------------------- <soapenv:Body> <ns1:login xmlns:ns1="urn:soap.sof.com"> <ns1:userInfo> <ns1:username>superuser</ns1:username> <ns1:password>qapass</ns1:password> </ns1:userInfo> </ns1:login> </soapenv:Body> However, how when I read using AXIS2 and I have tested it with java6 as well, I am having a problem. MessageFactory factory = MessageFactory.newInstance(); SOAPMessage soapMsg = factory.createMessage(new MimeHeaders(), SimpleTest.class.getResourceAsStream("LoginSoap.xml")); SOAPBody body = soapMsg.getSOAPBody(); NodeList nodeList = body.getElementsByTagNameNS("urn:soap.sof.com", "login"); System.out.println("Try to get login element" + nodeList.getLength()); // I can get the login element Node item = nodeList.item(0); NodeList elementsByTagNameNS = ((Element)item).getElementsByTagNameNS("urn:soap.sof.com", "username"); System.out.println("try to get username element " + elementsByTagNameNS.getLength()); So if I replace the 2nd getElementsByTagNameNS with ((Element)item).getElementsByTagName("username");, I am able to get the username element. Doesn't username have ns1 namespace even though it doesn't have the prefix? Am I suppose to keep track of the namespace scope to read an element? Wouldn't it became nasty if my xml elements are many level deep? Is there a workaround where I can read the element in ns1 namespace without knowing whether a prefix is defined?

    Read the article

  • Analyzing an IronPython Scope

    - by Vercinegetorix
    I'm trying to write C# code with an embedded IronPython script. Then want to analyze the contents of the script, i.e. list all variables, functions, class and their members/methods. There's an easy way to start, assuming I've got a scope defined and code executed in it already: dynamic variables=pyScope.GetVariables(); foreach (string v in variables) { dynamic dynamicV=pyScope.GetVariable(); /*seems to return everything. variables, functions, classes, instances of classes*/ } But how do I figure out what the type of a variable is? For the following python 'objects', dynamicV.GetType() will return different values: x=5 --system.Int32 y="asdf" --system.String def func():... --IronPython.Runtime.PythonFunction z=class() -- IronPython.Runtime.Types.OldInstance, how can I identify what the actual python class is? class NewClass -- throws an error, GetType() is unavailable. This is almost what I'm looking for. I could capture the exception thrown when unavailable and assume it's a class declaration, but that seems unclean. Is there a better approach? To discover the members/methods of a class it looks like I can use: ObjectOperations op = pyEngine.Operations; object instance = op.Call("className"); foreach (string j in op.GetMemberNames("className")) { object member=op.GetMember(instance, j); Console.WriteLine(member.GetType()); /*once again, GetType() provides some info about the type of the member, but returns null sometimes*/ } Also, how do I get the parameters to a method? Thanks!

    Read the article

  • Passing the form scope to a Remote cfc

    - by cf_PhillipSenn
    What is the syntax for passing the form scope into a cfc with access="remote"? I have: <cfcomponent> <cfset Variables.Datasource = "xxx"> <cffunction name="Save" access="remote"> <cfset var local = {}> <!--- todo: try/catch ---> <cfif arguments.PersonID> <cfquery datasource="#Variables.Datasource#"> UPDATE Person SET FirstName = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.FirstName#"> ,LastName = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.LastName#"> WHERE PersonID = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.PersonID#"> </cfquery> <cfset local.result = arguments.PersonID> <cfelse> <cfquery name="local.qry" datasource="#Variables.Datasource#"> INSERT INTO Person(FirstName,LastName) VALUES( <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.FirstName#"> ,<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.LastName#"> ); SELECT PersonID FROM Person WHERE PersonID=Scope_Identity() </cfquery> <cfset local.result = local.qry.PersonID> </cfif> <cfreturn local.result> </cffunction> </cfcomponent> I need to pass in form.PersonID, form.firstname, form.lastname.

    Read the article

  • Scope of the c++ using directive

    - by ThomasMcLeod
    From section 7.3.4.2 of the c++11 standard: A using-directive specifies that the names in the nominated namespace can be used in the scope in which the using-directive appears after the using-directive. During unqualified name lookup (3.4.1), the names appear as if they were declared in the nearest enclosing namespace which contains both the using-directive and the nominated namespace. [ Note: In this context, “contains” means “contains directly or indirectly”. —end note ] What do the second and third sentences mean exactly? Please give example. Here is the code I am attempting to understand: namespace A { int i = 7; } namespace B { using namespace A; int i = i + 11; } int main(int argc, char * argv[]) { std::cout << A::i << " " << B::i << std::endl; return 0; } It print "7 7" and not "7 18" as I would expect. Sorry for the typo, the program actually prints "7 11".

    Read the article

  • Macro not declared in this scope

    - by NmdMystery
    I'm using a preprocessor #define macro to count the number of functions in a header file: #define __INDEX -1 //First group of functions void func1(void); #define __FUNC1_INDEX __INDEX + 1 void func2(void); #define __FUNC2_INDEX __FUNC1_INDEX + 1 #undef __INDEX #define __INDEX __FUNC2_INDEX //Second group of functions void func3(void); #define __FUNC3_INDEX __INDEX + 1 void func4(void); #define __FUNC4_INDEX __FUNC3_INDEX + 1 #undef __INDEX #define __INDEX __FUNC4_INDEX //Third group of functions void func5(void); #define __FUNC5_INDEX __INDEX + 1 void func6(void); #define __FUNC6_INDEX __FUNC5_INDEX + 1 #undef __INDEX #define __INDEX __FUNC6_INDEX #define __NUM_FUNCTIONS __INDEX + 1 The preprocessor gets through the first two sets of functions just fine, but when it reaches the line: #define __FUNC5_INDEX __INDEX + 1 I get a "not defined in this scope" error for __INDEX. What makes this really confusing is the fact that the same exact thing is done [successfully] in the second group of functions; __FUNC3_INDEX takes on the value of __INDEX + 1. There's no typos anywhere, as far as I can tell... what's the problem? I'm using g++ 4.8.

    Read the article

  • 'area' not declared in this scope

    - by user1641173
    I've just started learning c++ and am trying to write a program for finding the area of a circle. I've written the program and whenever I try to compile it I get 2 error messages. The first is: areaofcircle.cpp:9:14: error: expected unqualified-id before numeric constant and the second is: areaofcircle.cpp:18:5: error: 'area' was not declared in this scope What should I do? I would post a picture, but I'm a new user, so I can't. #include <iostream> using namespace std; #define pi 3.1415926535897932384626433832795 int main() { // Create three float variable values: r, pi, area float r, pi, area; cout << "This program computes the area of a circle." << endl; // Prompt user to enter the radius of the circle, read input value into variable r cout << "Enter the radius of the circle " << endl; cin >> r; // Square r and then multiply by pi area = r * r * pi; cout << "The area is " << area << "." << endl; }

    Read the article

  • Objective-C Out of scope problem

    - by davbryn
    Hi, I'm having a few problems with some Objective-C and would appreciate some pointers. So I have a class MapFileGroup which has the following simple interface (There are other member variables but they aren't important): @interface MapFileGroup : NSObject { NSMutableArray *mapArray; } @property (nonatomic, retain) NSMutableArray *mapArray; mapArray is @synthesize'd in the .m file. It has an init method: -(MapFileGroup*) init { self = [super init]; if (self) { mapArray = [NSMutableArray arrayWithCapacity: 10]; } return self; } It also has a method for adding a custom object to the array: -(BOOL) addMapFile:(MapFile*) mapfile { if (mapfile == nil) return NO; mapArray addObject:mapfile]; return YES; } The problem I get comes when I want to use this class - obviously due to a misunderstanding of memory management on my part. In my view controller I declare as follows: (in the @interface): MapFileGroup *fullGroupOfMaps; With @property @property (nonatomic, retain) MapFileGroup *fullGroupOfMaps; Then in the .m file I have a function called loadMapData that does the following: MapFileGroup *mapContainer = [[MapFileGroup alloc] init]; // create a predicate that we can use to filter an array // for all strings ending in .png (case insensitive) NSPredicate *caseInsensitivePNGFiles = [NSPredicate predicateWithFormat:@"SELF endswith[c] '.png'"]; mapNames = [unfilteredArray filteredArrayUsingPredicate:caseInsensitivePNGFiles]; [mapNames retain]; NSEnumerator * enumerator = [mapNames objectEnumerator]; NSString * currentFileName; NSString *nameOfMap; MapFile *mapfile; while(currentFileName = [enumerator nextObject]) { nameOfMap = [currentFileName substringToIndex:[currentFileName length]-4]; //strip the extension mapfile = [[MapFile alloc] initWithName:nameOfMap]; [mapfile retain]; // add to array [fullGroupOfMaps addMapFile:mapfile]; } This seems to work ok (Though I can tell I've not got the memory management working properly, I'm still learning Objective-C); however, I have an (IBAction) that interacts with the fullGroupOfMaps later. It calls a method within fullGroupOfMaps, but if I step into the class from that line while debugging, all fullGroupOfMaps's objects are now out of scope and I get a crash. So apologies for the long question and big amount of code, but I guess my main question it: How should I handle a class with an NSMutableArray as an instance variable? What is the proper way of creating objects to be added to the class so that they don't get freed before I'm done with them? Many thanks

    Read the article

  • GLOBALS ARE BAAAAAAADDDD!!!!!

    - by Matt
    HOWEVER! would setting the $link to my database be one thing that I prolly should use a GLOBAL scope for? In my setting of (lots of functions)...it seems as though having only one variable that is on the global scope would be wise. I am currently using the functions to transfer it back and forth so that way I do not have it on global...but it is a bit of a hinder to my script. Please Advise, Thank you. Matt

    Read the article

  • Problems with :uniq => true/Distinct option in a has_many_through association w/ named scope (Rails)

    - by MikeH
    I had to make some tweaks to my app to add new functionality, and my changes seem to have broken the :uniq option that was previously working perfectly. Here's the set up: #User.rb has_many :products, :through = :seasons, :uniq = true has_many :varieties, :through = :seasons, :uniq = true #product.rb has_many :seasons has_many :users, :through = :seasons, :uniq = true has_many :varieties #season.rb belongs_to :product belongs_to :variety belongs_to :user named_scope :by_product_name, :joins = :product, :order = 'products.name' #variety.rb belongs_to :product has_many :seasons has_many :users, :through = :seasons, :uniq = true First I want to show you the previous version of the view that is now breaking, so that we have a baseline to compare. The view below is pulling up products and varieties that belong to the user. In both versions below, I've assigned the same products/varieties to the user so the logs will looking at the exact same use case. #user/show <% @user.products.each do |product| %> <%= link_to product.name, product %> <% @user.varieties.find_all_by_product_id(product.id).each do |variety| %> <%=h variety.name.capitalize %></p> <% end %> <% end %> This works. It displays only one of each product, and then displays each product's varieties. In the log below, product ID 1 has 3 associated varieties. And product ID 43 has none. Here's the log output for the code above: Product Load (11.3ms) SELECT DISTINCT `products`.* FROM `products` INNER JOIN `seasons` ON `products`.id = `seasons`.product_id WHERE ((`seasons`.user_id = 1)) ORDER BY name, products.name Product Columns (1.8ms) SHOW FIELDS FROM `products` Variety Columns (1.9ms) SHOW FIELDS FROM `varieties` Variety Load (0.7ms) SELECT DISTINCT `varieties`.* FROM `varieties` INNER JOIN `seasons` ON `varieties`.id = `seasons`.variety_id WHERE (`varieties`.`product_id` = 1) AND ((`seasons`.user_id = 1)) ORDER BY name Variety Load (0.5ms) SELECT DISTINCT `varieties`.* FROM `varieties` INNER JOIN `seasons` ON `varieties`.id = `seasons`.variety_id WHERE (`varieties`.`product_id` = 43) AND ((`seasons`.user_id = 1)) ORDER BY name Ok, so everything above is the previous version which was working great. In the new version, I added some columns to the join table called seasons, and made a bunch of custom methods that query those columns. As a result, I made the following changes to the view code that you saw above so that I could access those methods on the seasons model: <% @user.seasons.by_product_name.each do |season| %> <%= link_to season.product.name, season.product %> #Note: I couldn't get this loop to work at all, so I settled for the following: #<% @user.varieties.find_all_by_product_id(product.id).each do |variety| %> <%=h season.variety.name.capitalize %> <%end%> <%end%> Here's the log output for that: SQL (0.9ms) SELECT count(DISTINCT "products".id) AS count_products_id FROM "products" INNER JOIN "seasons" ON "products".id = "seasons".product_id WHERE (("seasons".user_id = 1)) Season Load (1.8ms) SELECT "seasons".* FROM "seasons" INNER JOIN "products" ON "products".id = "seasons".product_id WHERE ("seasons".user_id = 1) AND ("seasons".user_id = 1) ORDER BY products.name Product Load (0.7ms) SELECT * FROM "products" WHERE ("products"."id" = 43) ORDER BY products.name CACHE (0.0ms) SELECT "seasons".* FROM "seasons" INNER JOIN "products" ON "products".id = "seasons".product_id WHERE ("seasons".user_id = 1) AND ("seasons".user_id = 1) ORDER BY products.name Product Load (0.4ms) SELECT * FROM "products" WHERE ("products"."id" = 1) ORDER BY products.name Variety Load (0.4ms) SELECT * FROM "varieties" WHERE ("varieties"."id" = 2) ORDER BY name CACHE (0.0ms) SELECT * FROM "products" WHERE ("products"."id" = 1) ORDER BY products.name Variety Load (0.4ms) SELECT * FROM "varieties" WHERE ("varieties"."id" = 8) ORDER BY name CACHE (0.0ms) SELECT * FROM "products" WHERE ("products"."id" = 1) ORDER BY products.name Variety Load (0.4ms) SELECT * FROM "varieties" WHERE ("varieties"."id" = 7) ORDER BY name CACHE (0.0ms) SELECT * FROM "products" WHERE ("products"."id" = 43) ORDER BY products.name CACHE (0.0ms) SELECT count(DISTINCT "products".id) AS count_products_id FROM "products" INNER JOIN "seasons" ON "products".id = "seasons".product_id WHERE (("seasons".user_id = 1)) CACHE (0.0ms) SELECT "seasons".* FROM "seasons" INNER JOIN "products" ON "products".id = "seasons".product_id WHERE ("seasons".user_id = 1) AND ("seasons".user_id = 1) ORDER BY products.name CACHE (0.0ms) SELECT * FROM "products" WHERE ("products"."id" = 1) ORDER BY products.name CACHE (0.0ms) SELECT * FROM "products" WHERE ("products"."id" = 1) ORDER BY products.name CACHE (0.0ms) SELECT * FROM "varieties" WHERE ("varieties"."id" = 8) ORDER BY name I'm having two problems: (1) The :uniq option is not working for products. Three distinct versions of the same product are displaying on the page. (2) The :uniq option is not working for varieties. I don't have validation set up on this yet, and if the user enters the same variety twice, it does appear on the page. In the previous working version, this was not the case. The result I need is that only one product for any given ID displays, and all varieties associated with that ID display along with such unique product. One thing that sticks out to me is the sql call in the most recent log output. It's adding 'count' to the distinct call. I'm not sure why it's doing that or whether it might be an indication of an issue. I found this unresolved lighthouse ticket that seems like it could potentially be related, but I'm not sure if it's the same issue: https://rails.lighthouseapp.com/projects/8994/tickets/2189-count-breaks-sqlite-has_many-through-association-collection-with-named-scope I've tried a million variations on this and can't get it working. Any help is much appreciated!

    Read the article

  • What is session management in Java ?

    - by Sarang
    I have faced this question in my Interview as well. I do have many confusion with Session Scope & it management in java. In web.xml we do have the entry : <session-config> <session-timeout> 30 </session-timeout> </session-config> What does it indicate actually ? Is is scope of whole project ? Another point confusing me is how can we separate the session scope of multiple request in the same project? Means if I am logging in from a PC & at the same time I am logging in from another PC, does it differentiate it ? Also, another confusing thing is the browser difference. Why does the different Gmails possible to open in different browsers ? And Gmail can prevent a session from Login to Logout. How is it maintained with our personal web ?

    Read the article

  • Mixing AJAX requests with Flash scope objects not working

    - by AlanObject
    I have a JSF page that displays a table from an object called TableQuery that supports stateful pagination, sorting, etc. The bean that accesses the object is a RequestScoped object, and it attempts to preserve the TableQuery by storing it the flash map. The accessor method looks like this: public TableQuery<SysLog> getQuery() { if (query != null) return query; Flash flash = FacesContext.getCurrentInstance(). getExternalContext().getFlash(); query = (TableQuery) flash.get("Query"); if (query != null) System.out.println("TableSysLog.getQuery() Got query from flash!"); if (query == null) { query = slc.getNewTableQuery(); System.out.println("TableSysLog.getQuery() Created new query"); } flash.put("Query", query); return query; } The Links to go between pages are implemented with *p:commandLInk*s. I use Primefaces command link in AJAX mode so just the link gets processed when it is clicked. The action listener looks like this: public void doNextPage(ActionEvent evt) { getQuery().doNextPage(); } When it doesn't work I get the error message: WARNING: JSF1095: The response was already committed by the time we tried to set the outgoing cookie for the flash. Any values stored to the flash will not be available on the next request. I found this thread when looking up this problem. When I turned of HTTP chunking as the article suggests, the error message went away but the problem remained. Does anyone know what is going on and how this might be fixed?

    Read the article

  • Scope of StaticResource within a WPF ResourceDictionary

    - by Nicolas Webb
    I have a WPF ResourceDictionary with the following TextBlock: <TextBlock Visibility="{Binding Converter={StaticResource MyBoolProp ResourceKey=BoolToVis}}"> </TextBlock> The ResourceDictionary is included in App.xaml under MergedDictionaries: <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="MyResourceDictionary.xaml"/> Within the App.xaml I have defined the BoolToVis converter (again, under Application.Resources) <BooleanToVisibilityConverter x:Key="BoolToVis" /> When I start my app up - I get the following XamlParseException: "Provide value on 'System.Windows.Markup.StaticResourceHolder' threw an exception." The InnerException is: "Cannot find resource named 'BoolToVis'. Resource names are case sensitive." I'm able to refer to this converter directly with App.xaml (in fact, it's another TextBlock) and within other UserControls with no problems. This particular bit of code also worked fine under the .NET 4.0 RC (and Beta2). This error only started happening when I upgraded to the .NET 4.0 RTM. I'm able to work around it by declaring another BooleanToVisibilityConverter within MyResourceDictionary.xaml and referring to it like so: <TextBlock Visibility="{Binding Converter={StaticResource MyBoolProp ResourceKey=BoolToVis2}}"> </TextBlock> Any reason why I should need to do this?

    Read the article

  • the scope of a pointer ???

    - by numerical25
    Ok, so I did find some questions that were almost similar but they actually confused me even more about pointers. http://stackoverflow.com/questions/2715198/c-pointer-objects-vs-non-pointer-objects-closed In the link above, they say that if you declare a pointer it is actually saved on the heap and not on the stack, regardless of where it was declared at. Is this true ?? Or am I misunderstanding ??? I thought that regardless of a pointer or non pointer, if its a global variable, it lives as long as the application. If its a local variable or declared within a loop or function, its life is only as long as the code within it.

    Read the article

  • BlackBerry - KeyListener with global scope

    - by Abs
    Hello all, I am new to BlackBerry App development. I want to be able to listen for keypress events whenever the BlackBerry (8900 in my case) is on and on all screens is this possible? If so, it would be great for someone to direct me in the right direction. I am already having a look at Interface KeyListener. import net.rim.device.api.system.*; Thanks all

    Read the article

  • Initiate User Scope Class at Session Start

    - by James Santiago
    I want to initiate a class for each user at the start of the user's session so that a single class can be used throughout the user's session. I checked out this post but I'm not sure where I should be placing this Sessionhandler class. Inside global.asax? How do I go about accomplishing this?

    Read the article

  • Scope of Connection Object for a Website using Connection Pooling (Local or Instance)

    - by Danny
    For a web application with connection polling enabled, is it better to work with a locally scoped connection object or instance scoped connection object. I know there is probably not a big performance improvement between the two (because of the pooling) but would you say that one follows a better pattern than the other. Thanks ;) public class MyServlet extends HttpServlet { DataSource ds; public void init() throws ServletException { ds = (DataSource) getServletContext().getAttribute("DBCPool"); } protected void doGet(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException { SomeWork("SELECT * FROM A"); SomeWork("SELECT * FROM B"); } void SomeWork(String sql) { Connection conn = null; try { conn = ds.getConnection(); // execute some sql ..... } finally { if(conn != null) { conn.close(); // return to pool } } } } Or public class MyServlet extends HttpServlet { DataSource ds; Connection conn;* public void init() throws ServletException { ds = (DataSource) getServletContext().getAttribute("DBCPool"); } protected void doGet(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException { try { conn = ds.getConnection(); SomeWork("SELECT * FROM A"); SomeWork("SELECT * FROM B"); } finally { if(conn != null) { conn.close(); // return to pool } } } void SomeWork(String sql) { // execute some sql ..... } }

    Read the article

  • What is the scope of xsl apply-imports?

    - by calavera.info
    My original idea about apply-imports was that if there are two templates which matches the same node, then using apply-imports in a template with higher priority runs the template with the lower priority. But I recently find out that it's important how are imports organized. Two cases interests me particularly. Will apply imports work on a template which is imported in imported file (nested import)? How about a "sibling import" (master file imports two files with templates matching the same nodes) It seems to me that this is not clearly described in specification. Could someone provide authoritative guidelines? EDIT: I can try those cases on my own, but there is always a danger that it will be implementation specific behavior.

    Read the article

  • C stack/scope, variable's lifetime after functions ends

    - by Ranking Stackingblocks
    void someFunc() { int stackInt = 4; someOtherFunc(&stackInt); } Is it the case that stackInt's address space could be reallocated after someFunc ends, making it unsafe to assume that the value passed to someOtherFunc represents the stackInt variable with value 4 that was passed to it? In other words, should I avoid passing stack variables around by address and expecting them to still be alive after the function they were initialised in has ended?

    Read the article

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