Search Results

Search found 13794 results on 552 pages for 'variable scope'.

Page 29/552 | < Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >

  • XPath: limit scope of result set

    - by Laramie
    Given the XML <a> <c> <b id="1" value="noob"/> </c> <b id="2" value="tube"/> <a> <c> <b id="3" value="foo"/> </c> <b id="4" value="goo"/> <b id="5" value="noob"/> <a> <b id="6" value="near"/> <b id="7" value="bar"/> </a> </a> </a> and the Xpath 1.0 query //b[@id=2]/ancestor::a[1]//b[@value="noob"] is there some way to limit the result set to the <b> elements that are ONLY the children of the immediate <a> element of the start node (//b[@id=2])? For example the Xpath above returns both node ids 1 and 5. The goal is to limit the result to just node id=1 since it is the only @value="noob" element in the same <c> group as our start node (//b[@id=2]). In English, "Starting at a node whose id is equal to 2, find all the elements whose value is "noob" that are descendants of the immediate parent c element without passing through another c element".

    Read the article

  • Another passing variable through function jQuery/JS problem...

    - by dallen
    Here's my code: function mouseOver(variable) { return function() { $(variable).fadeIn(100); }; } function mouseOut(variable) { return function() { $(variable).fadeOut(100); }; } function lawyer(var1, var2, var3, var4) { return function() { $(var1).bind('mouseenter', mouseOver(var2)).bind('mouseleave', mouseOut(var2)).click( function() { $(var1).unbind('mouseenter').unbind('mouseleave'); $(var1).removeClass('off').addClass('on'); $(var3).bind('mouseenter', mouseOver(var4)).bind('mouseleave', mouseOut(var4)); $(var3).removeClass('on').addClass('off'); $(var4).hide(); }); } } lawyer("#group", ".b", "#group2", ".l"); What would be the reason for this not working? It works in that it hides $(var4).hide();, but clicking on the object doesn't seem to do anything. It works if I take the code out of a function and just copy/paste it a few times and change the targets. I'm not seeing it... Any help would be appreciated!

    Read the article

  • Linq Scope Problem + Reduce Repeated Code

    - by Tom Gullen
    If the parameter is -1, it needs to run a different query as to if an ID was specified... how do I do this? I've tried initialising var q; outside the If block but no luck! // Loads by Entry ID, or if -1, by latest entry private void LoadEntryByID(int EntryID) { IEnumerable<tblBlogEntry> q; if (EntryID == -1) { q = ( from Blog in db.tblBlogEntries orderby Blog.date descending select new { Blog.ID, Blog.title, Blog.entry, Blog.date, Blog.userID, Comments = ( from BlogComments in db.tblBlogComments where BlogComments.blogID == Blog.ID select BlogComments).Count(), Username = ( from Users in db.yaf_Users where Users.UserID == Blog.userID select new { Users.DisplayName }) }).FirstOrDefault(); } else { q = ( from Blog in db.tblBlogEntries where Blog.ID == EntryID select new { Blog.ID, Blog.title, Blog.entry, Blog.date, Blog.userID, Comments = ( from BlogComments in db.tblBlogComments where BlogComments.blogID == Blog.ID select BlogComments).Count(), Username = ( from Users in db.yaf_Users where Users.UserID == Blog.userID select new { Users.DisplayName }) }).SingleOrDefault(); } if (q == null) { this.Loaded = false; } else { this.ID = q.ID; this.Title = q.title; this.Entry = q.entry; this.Date = (DateTime)q.date; this.UserID = (int)q.userID; this.Loaded = true; this.AuthorUsername = q.Username; } } My main aim is to reduce repeating code

    Read the article

  • How to get an variable output from remote pssession

    - by Vinith menon
    I have a script to get virtual harddisk info from vmm, im executing it remotely from a server, currently im unable to get the variable value outside of the pssession in the local host, could you please help me out with achieveing the same. PS C:\Windows\system32> enter-pssession iscvmm02 [iscvmm02]: PS C:\Users\su\Documents>Add-PSSnapin Microsoft.SystemCenter.VirtualMachineManager [iscvmm02]: PS C:\Users\su\Documents>$hide= Get-VMMServer -ComputerName "iscvmm02.corp.avanade.org" [iscvmm02]: PS C:\Users\su\Documents>$VM = Get-VM | where { $_.ComputerNameString -contains "idpsm02.corp.air.org" } [iscvmm02]: PS C:\Users\su\Documents>$harddisk=$VM.VirtualHardDisks [iscvmm02]: PS C:\Users\su\Documents>$h=$harddisk.length [iscvmm02]: PS C:\Users\su\Documents>for($i=0;$i-lt$h;$i++){ New-Variable -Name "HardDiskType_$i" -value $harddisk[$i].vhdtype New-Variable -Name "HardDiskLocation_$i" -value $harddisk[$i].Location } [iadpscvmm02]: PS C:\Users\su\Documents>Exit-PSSession PS C:\Windows\system32>$harddisktype_0 PS C:\Windows\system32>$harddisklocation_0 as you can see both the variable output's give null value, im unable to retain the values

    Read the article

  • Javascript: variable scope & the evils of globals

    - by Nick
    I'm trying to be good, I really am, but I can't see how to do it :) Any advice on how to not use a global here would be greatly appreciated. Let's call the global G. Function A Builds G by AJAX Function B Uses G Function C Calls B Called by numerous event handlers attached to DOM elements (type 1) Function D Calls B Called by numerous event handlers attached to DOM elements (type 2) I can't see how I can get around using a global here. The DOM elements (types 1 & 2) are created in other functions (E&F) which are unconnected with A. I don't want to add G to each event handler (because it's large and there's lots of these event handlers), and doing so would require the same kind of solution as I'm seeking here (i.e., getting G to E&F). The global G, BTW, is an array that is necessary to build other elements as they, in turn, are built by AJAX. I'm not convinced that a singleton is real solution, either. Thanks.

    Read the article

  • Inserting a line break from a variable objective c

    - by user337174
    I am pulling data into my iphone application using xml. The xml value is then placed in a variable. example variable: 123 London road \n London \n England The variable is then set as a label. I want the line breaks to appear in the label, instead it is printing \n. If i manually set the label value locationLabel.text = @"123 London road \n London \n England" It works as i want it to. Can anyone explain this?

    Read the article

  • 'EXC_BAD_ACCESS' When trying to access a variable?

    - by Nick Brooks
    I get an 'EXC_BAD_ACCESS' error when trying to access variable in a function other than the one it was set in: NSLog(@"Commening search (%@)",sessionID); // This causes it The variable is set in the 'awakeFromNib' function: //Retrieve Session-ID sessionID = [self getSessionID]; The variable itself is defined in the header: NSString *sessionID;

    Read the article

  • VB Script Creating variable on the fly returned Error Automation type not supported

    - by chazzuka
    I have list of variables in an include files which is looks like: var_1 = "string" var_2 = "string" on the main file i need variable created on the fly so i do ' somewhere i have the num variable Execute("new_var = var_"&num) Exactly on the execute line i got this error Microsoft VBScript runtime error '800a01ca' Variable uses an Automation type not supported in VBScript Any idea guys? thanks

    Read the article

  • Push a variable into global scope?

    - by Spot
    We use instantiate and put system critical objects in $GLOBALS for easy access from anywhere (e.g. DB, Cache, User, etc.). We use $GLOBALS so much that it would (yes, really) drop the amount of code quite a bit if I could reference it like $G = &$GLOBALS for a shorthand call. The problem is that, per my experience and several hours of Googling, I have not found any construct in PHP which allows you to 'flag' a var as global, making $GLOBALS first class, and everything else second class. Am I missing something? Is this possible?

    Read the article

  • Javascript: Static member variable containing object instances

    - by tom
    I have the following: function Preferences() { } Preferences.players = { 'player1': new Player() } players is a static member variable of Preferences and I'm trying to make it an object containing an instance of a Player. However, it doesn't appear to let me do this. It seems like it will allow me to define players if I make it a non-static member variable however. Like so: function Preferences() { var players = { 'player1' : new Player() } } Is it possible to create a static member variable containing instances of an object in JS?

    Read the article

  • Error with global variable in php not extending to included php file

    - by phileaton
    I have an html file that calls has a php section in the header like so: $page = basename($_SERVER['PHP_SELF']); Now further down in the html file I have a included footer like so: <?php include("footer.php"); ?> In this script I am referencing the $page variable, but it doesn't find it. I tried echoing the variable and nothing happened. When I place the basename() code in the footer.php file though, it handled it fine. I'd like to be efficient with the coding, so how can I get the footer.php file to get that $page variable? Is there a better way to do this than including the $page variable twice?

    Read the article

  • Global Variable problem

    - by riteshkumar1905
    Hi, I am new in iphone.I use a flag variable to play songs in avAudio player all songs are properly handeled with flag variable.we have two tabs in tab bar , i want that if any song playing then on other tab song info show.If we use that flag variable then i syncronize song info with song.But i can't access the value of flag on song info tab.I import the global file in song info file. Please Help me any one through which i define a global integer that var i can access in all project.

    Read the article

  • Rails Variable across all controller actions

    - by bob
    Hello, This should be a very simple rails question. I have a variable like the following. @administration = Administration.first I want this variable to be accessible through every controller action across all my controllers so for example if I have a Product controller and inside of it I have the usual CRUD actions, I want the @administration variable as defined above to be put into all the CRUD actions. (It would not be needed in destroy or create or update). I have many controllers throughout my project and I was wondering if there is an easier way than adding it manually through all of the actions that I want it in. I tried a global variable $administration = Administration.first but I run into an issue where it is not updated when I update the actual content of the Administration.first table. Also, I would like to avoid global variables. Any help would be much appreciated. Thanks! :)

    Read the article

  • Can I use a string variable to reference a class variable?

    - by rson
    Here's the scenario: I have an external swf file with x number of movieclips in its library that I load into a containing swf. Each MC in the external swf is linked with a class name and referenced on frame 1 as such var unique1:lineSequence1 = new lineSequence1(); the unique1 variable name will match a string variable I create in the containing swf: function initLines():void{ lineLoader = new Loader(); lineLoader.load(new URLRequest("theLines.swf")); //load external swf lineLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, linesLoaded); } function linesLoaded(e:Event):void{ var loadedswf:MovieClip = e.target.content as MovieClip; var initialLines = projects[0].pageid; //projects is an xmllist trace("initialLines: "+initialLines); //returns "initialLines: unique1" lines_holder_mc.addChild(loadedswf.[initialLines]); } I would like to use the initialLines variable as the reference to unique1 instead of hardcoding unique1 into loadedswf.unique1 to reference said variable in the loaded swf.

    Read the article

  • Retrieve web user's Identity outside of request scope

    - by Kendrick
    I have an ASP.NET app that logs Audit reports using nHibernate's IPreUpdateListener. In order to set the current user in the Listener events, I was using System.Security.Principal.WindowsIdentity.GetCurrent(). This works fine when debugging on my machine, but when I move it to the staging server, I'm getting the ASP.NET process credentials, not the requesting user. In the ASP.NET page, I can use Request.LogonUserIdentity (which works fine since I'm using integrated authentication), but how do I reference this user directly without having to pass it directly to my event? I don't want to have to pass this info through the pipeline because it really doesn't belong in the intermediate events/calls.

    Read the article

  • update variable after success of ajax function

    - by Scarface
    Hey guys quick question, I am sending a request with the jquery ajax function with a variable. After the request I want that variable updated to match the value of the sent back information, so next time the ajax function executes, it send the value of the new variable. $.ajax({ type: "POST", data: "countusers=" + countusers, url: "tester.php", dataType: 'json', success: function(json) { var countusers=json.rownumber; } } })

    Read the article

  • Query scope within a table trigger in an Oracle database

    - by sisslack
    I'm been trying to write a table trigger the queries another table that is outside the schema where the trigger will reside. Is this possible? It seems like I have no problem querying tables in my schema but I get: Error: ORA-00942: table or view does not exist when trying trying to query tables outside my schema. The documentation seems to elude to this notion, but it's not 100% clear to me.

    Read the article

  • JS variable scope missunderstanding

    - by meo
    I have a little problem: slideHelpers.total = 4 for (i=1;i <= slideHelpers.total; i++) { $('<a href="#">' + i + '</a>').bind('click', function(){ alert('go to the ' + i + ' slide')}).appendTo('.slideaccess') } the alert gives out 5 what is logic, because when the function click triggers i is actually 5. But i would like to have the same i as in my <a> tag. What is the best way to handle this? I could put i in the data() of the <a> tag for example but i am sure there is a easier way.

    Read the article

  • C++: Declare static variable in function argument list

    - by MDC
    Is there any way at all in C++ to declare a static variable while passing it to a function? I'm looking to use a macro to expand to the expression passed to the function. The expression needs to declare and initialize a static variable on that particular line (based on the filename and line number using FILE and LINE). int foo(int b) { int c = b + 2; return c; } int main() { int a = 3; a = foo(static int h = 2); //<---- see this! cout << a; return 0; } The problem I'm trying to solve is getting the filename and line number with the FILE and LINE macros provided by the preprocessor, but then creating a lookup table with integer keys leading to the FILE, LINE pairs. For example, the key 89 may map to file foo.cpp, line 20. To get this to work, I'm trying to use local static variables, so that they are initialized only once per line execution. The static variable will be initialized by calling a function that calculates the integer key and adds an entry to the lookup table if it is not there. Right now the program uses a message class to send exception information. I'm writing a macro to wrap this class into a new class: WRAPPER_MACRO(old_class_object) will expand to NewClass(old_class_object, key_value). If I add the static variable declaration as a second line right before this, it should work. The problem is that in most places in the code, the old class object is passed as an argument to a function. So the problem becomes declaring and initializing the static variable somehow with the macro, while keeping the existing function calls.

    Read the article

  • Create categorial variable in R based on range

    - by Stedy
    I have a dataframe with a column of integers that I would like to use as a reference to make a new categorical variable. I want to divide the variable into three groups and set the ranges myself (ie 0-5, 6-10, etc). I tried cut but that divides the variable into groups based on a normal distribution and my data is right skewed. I have also tried to use if/then statements but this outputs a true/false value and I would like to keep my original variable. I am sure that there is a simple way to do this but I cannot seem to figure it out. Any advice on a simple way to do this quickly?

    Read the article

  • Problem about C++ class (inheritance, variables scope and functions)

    - by Luigi Giaccari
    I have a class that contains some data: class DATA Now I would to create some functions that uses those data. I can do it easily by writing member functions like DATA::usedata(); Since there are hundreds of functions, I would to keep an order in my code, so I would like to have some "categories" (not sure of the correct name) like: DATA data; data.memory.free(); data.memory.allocate(); data.file.import(); data.whatever.foo(); where memory, file and whatever are the "categories" and free, allocate and foo are the functions. I tried the inheritance way, but I got lost since I can not declare inside DATA a memory or file object, error C2079 occurs: http://msdn.microsoft.com/en-us/library/9ekhdcxs%28VS.80%29.aspx Since I am not a programmer please don't be too complicated and if you have an easier way I am all ears.

    Read the article

  • Understanding Scope on Scala's For Loops (For Comprehension)

    - by T. Stone
    In Chapter 3 of Programming Scala, the author gives two examples of for loops / for comprehensions, but switches between using ()'s and {}'s. Why is this the case, as these inherently look like they're doing the same thing? Is there a reason breed <- dogBreeds is on the 2nd line in example #2? // #1 ()'s for (breed <- dogBreeds if breed.contains("Terrier"); if !breed.startsWith("Yorkshire") ) println(breed) // #2 {}'s for { breed <- dogBreeds upcasedBreed = breed.toUpperCase() } println(upcasedBreed)

    Read the article

< Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >