Search Results

Search found 23079 results on 924 pages for 'local variables'.

Page 10/924 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • UIView drawRect; class variables out of scope

    - by Toby Wilson
    Short & sweet version of my last question in light of new information. I have a UIVIew with an init and a drawrect method (and another thread and a bunch of other stuff, but I'll keep it short & sweet). All of the class variables that I alloc and init in the -(id)init method are out of scope/nil/0x0 in the drawRect method, and I am unable to access them. For example; In the interface: NSObject* fred; In the implementation: -(id)init { if(self == [super init]) { fred = [[NSObject alloc] init]; } return self; } -(void)drawRect:(CGRect)rect { NSLog(@"Fred is retained %i times",[fred retainCount]); //FAIL NSLog(@"But his variable is actually just pointing at uninitialised 0x0, so you're not reading this in the debugger because the application has crashed before it got here." } Should add that init IS being called before drawRect also. Anyone have any ideas?

    Read the article

  • Ant trouble with environment variables on Ubuntu

    - by Inaimathi
    Having some trouble with with ant reading environment variables in Ubuntu 9.10. Specifically, the build tasks my company uses has a token like ${env.CATALINA_HOME] in the main build.xml. I set CATALINA_HOME to the correct value in /etc/environment, ~/.pam_environment and (just to be safe) my .bashrc. I can see the correct value when I run printenv from bash, or when I eval (getenv "CATALINA_HOME") in emacs. Ant refuses to build to the correct directory though; instead I get a folder named ${env.CATALINA_HOME} in the same directory as my build.xml. Any idea what's happening there, and/or how to fix it?

    Read the article

  • How do you give variables reference in javascript?

    - by Eric
    I want to give variables reference in javascript. For example, I want to do: a=1 b=a a=2 and have b=2, and change accordingly to a. Is this possible in javascript? If it isn't is there a way to do like a.onchange = function () {b=a}? What I wanted to do was make a function like makeobject which make an object and puts it in an array and than returns it like function makeobject() { objects[objects.length] = {blah:'whatever',foo:8}; } so than I could do a=makeobject() b=makeobject() c=makeobject() and later in the code do for (i in objects) { objects[i].blah = 'whatev'; } and also change the values of a,b and c

    Read the article

  • Js constants with variables inside.

    - by johnnyArt
    I know I'm able to this in PHP, but I can't remember the name or the way to do it, so I'll just explain what it is, and when someone tells me how it's called I'll update this question. I have some error messages defined as constants on javascript, however, some of those messages need to contain dynamic part as in the following example. "The username must be between 4 and 20 characters" In php, If I'm not mistaken there was some option for storing that string in a way that when called it would replace the variables with the data provided on the call. I want to do that on javascript, something like: config['string',vars] And have javascript insert those vars inside the string so it's customized. Wow, this must be the worst question I've made! I'm sorry for the lack of information, I'm kinda braindead on Sundays.

    Read the article

  • Create New Pseudo Variables in Squeak

    - by Artium
    Large part of squeak is implemented using squeak itself. I am curious to know if pseudo variables such as self or true are also implemented using squeak. If the answer is yes, where the implementation located? Specifically, assume that I want to add new subclass of "Boolean" called "Other" which will represent a third option: neither true nor false. I want that other, the only instance of Other to be similar to the true/false global singletons. Any ideas? Thank you.

    Read the article

  • Lexical and dynamic scoping in Mathematica: Local variables with Module, With, and Block

    - by dreeves
    The following code returns 14 as you'd expect: Block[{expr}, expr = 2 z; f[z_] = expr; f[7]] But if you change that Block to a Module then it returns 2*z. It seems to not matter what other variables besides expr you localize. I thought I understood Module, Block, and With in Mathematica but I can't explain the difference in behavior between Module and Block in this example. Related resources: Tutorial on Modularity and the Naming of Things from the Mathematica documentation Excerpt from a book by Paul R. Wellin, Richard J. Gaylord, and Samuel N. Kamin Explanation from Dave Withoff on the Mathematica newsgroup

    Read the article

  • Static Class Variables in Dynamic Library and Main Program

    - by Paul
    I am working on a project that has a class 'A' that contains a static stl container class. This class is included in both my main program and a .so file. The class uses the default(implicit, not declared) constructor/destructor. The main program loads the .so file using dlopen() and in its destructor, calls dlclose(). The program crashes after main exits when glibc calls the destructor for the static class member variable. The problem appears to be that when dlclose() is called, the destructor for the static variable is called, then when main exits() glibc also calls the destructor, resulting in a double free. I have 2 questions, namely: 1) In this particular case, why are there not two copies of the static variable(yes i know that sounds somewhat ridiculous, but since both the main program and .so file have a separately compiled 'A', shouldn't they each have one?) 2) Is there any way to resolve this issue without re-writing class 'A' to not contain static member variables?

    Read the article

  • Referencing Environment Variables in web.xml

    - by Udi Bar-On
    I'm pre-packaging a JSP web-app that relies on some file path settings found within web.xml. These settings are unknown at packaging time, because they reference a path the customer will set when deploying the entire application (of which the web-app is a management interface). It seems that the easiest way to avoid tokens and file modifications in my installer script, is to ask the user for an install location, set this location as an environment variable (e.g JAVA_HOME), and have web.xml always reference that variable. Is there a way to reference an environment variable value from within web.xml? Google searches lead to the J2EE method of SETTING environment variables from ejb xml files. This is not what I'm looking for. Thanks Udi

    Read the article

  • Global variables in jQuery

    - by Thorpe Obazee
    I have been working on this script: <script type="text/javascript" src="/js/jquery.js"></script> <script type="text/javascript"> $(function(){ compentecy = $('#competency_id'); $('#add_competency').bind('click', function(e){ e.preventDefault(); $.post('/script.php', {competency_id: compentecy.val(), syllabus_id: 2}, function(){ // competency = $('#competency_id'); competency.children('option[value=' + compentecy.val() + ']').remove(); }); }); }); </script> in the $.post callback function, it seems that I can't access global variables. I tried $.competency but it didn't work. I always get a "competency is undefined" error. I had to reinitialize the variable once again inside the callback. Is there a way to NOT reinitialize the variable inside the callback?

    Read the article

  • Error loading Variables stage.loaderInfo - AS3

    - by Dimitree
    I have a Document class that loads variables from Facebook with the use of stage.loaderInfo var connect:FacebookConnectObject = new FacebookConnectObject( facebook, API_KEY, this.stage.loaderInfo ); But when I change the Document class (with another one responsible for the layout of my app), and try call the above from a movieclip that exists in my application with the use: var facebook_class:FacebookAp = new FaceBppkApp addChild(facebook_class) I get error TypeError: Error #1009: Cannot access a property or method of a null object reference. I believe the error comes fro this line this.stage.loaderInfo since I changed the scope... How I am supposed to fix that?

    Read the article

  • Running Script before/after Variables declared?

    - by Sam
    Hi folks. As i understand javascript .js files are best to put all the way at the bottom of html pages, to speed up loading of rest of page. Advised by Yslow(Yahoo) and Page Speed(google). Now, when in the middle of page some thing RUNS a javascript script, in Internet Explorer, i see a small warning message saying that the element is: Uncaught ReferenceError: SWFObject is not defined When i put my all.js file in the had, the error goes away but page load slows doen. What to do? Actually, i remember it was the same with php variables. If i RUN php but the variable comes later, then it just doesnt work. must define the variable first, for it to run. How to make this workflow better, in case of php scripts? and in case of javsscripts? Thanks!

    Read the article

  • - Default value of variables at the time of declaration -

    - by gotye
    Hey guys, I was wondering what was the default values of variables before I intialize them .. For example, if I do : //myClass.h BOOL myBOOL; // default value ? NSArray *myArray; // default value ? NSUInteger myInteger; // default value ? Some more examples here : //myClass.m // myArray is not initialized, only declared in .h file if ([myArray count] == 0) { // TRUE or FALSE ? // do whatever } More generally, what is returned when I do : [myObjectOnlyDeclaredAndNotInitialized myCustomFunction]; Thank you for your answers. Gotye.

    Read the article

  • Problem with assigning elements of a class array to individual variables in MATLAB

    - by Marc
    This is a bit of a duplicate of this question, this question, and this question, however those solutions don't work, so I'm asking mine. I've got an array of locally defined classes and I'd like to assign it to multiple, individual variables. This pattern doesn't work: %a is 2x1 of MyClass temp = mat2cell(a); [x,y] = temp{:}; %throws: ??? Insufficient number of outputs from right hand side of equal sign to satisfy assignment. Because temp is a single cell, with my 2x1 array in one cell, rather than a 2x1 cell array with one element of each of my original array in one cell. Any ideas?

    Read the article

  • Dynamic Variables Within Functions

    - by Ryan
    Why does this work: function myfunction($v) { $query = $v['host'] == '1'; return ( $query ); } $output = array_filter($recordset,myfunction); print_r($output); Whereas this script, which tries to accomplish the same thing with variables, does not? $column1 = 'host'; $value1 = 1; $query1 = '$v[\''.$column1.'\'] == '.$value1; function myfunction($v) { $query = $GLOBALS['query1']; return ( $query ); } $output = array_filter($recordset,myfunction); print_r($output); Any help would be great. Thanks!

    Read the article

  • GNU make variables in Makefile

    - by JTom
    Hi, I would like to create a Makefile which also creates a simple script for running the compiled application. I have something like the following: @touch $(SCRIPT) @echo LD_LIBRARY_PATH=$(LIB_DIR) $(APP_DIR)/$(APP) $1 $2 $3 $4 $5 $6 > $(SCRIPT) @chmod +x $(SCRIPT) @echo Script successfully created. And I want $1 $2 ... to appear in the script exactly like $1 $2 ... to represent scripts command-line arguments. I can't get it worked because Makefile is using $1 $2 as its own variables.. How can I accomplish that?

    Read the article

  • Thread Local Memory for Scratch Memory.

    - by Hassan Syed
    I am using Protocol Buffers and OpensSSL to generate, HMACs and then CBC encrypt the two fields to obfuscate the session cookies -- similar Kerberos tokens. Protocol Buffers' API communicates with std::strings and has a buffer caching mechanism; I exploit the caching mechanism, for successive calls in the the same thread, by placing it in thread local memory; additionally the OpenSSL HMAC and EVP CTX's are also placed in the same thread local memory structure ( see this question for some detail on why I use thread local memory and the massive amount of speedup it enables even with a single thread). The generation and deserialization, "my algorithms", of these cookie strings uses intermediary void *s and std::strings and since Protocol Buffers has an internal memory retention mechanism I want these characteristics for "my algorithms". So how do I implement a common scratch memory ? I don't know much about the rdbuf of the std::string object. I would presumeably need to grow it to the lowest common size ever encountered during the execution of "my algorithms". Thoughts ?

    Read the article

  • Lifetime of javacript variables.

    - by The Machine
    What is the lifetime of a variable in javascript, declared with "var". I am sure, it is definitely not according to expectation. <script> function(){ var a; var fun=function(){ // a is accessed and modified } }(); </script> Here how and when does javascript garbage collect the variable a? Since 'a' is a part of the closure of the inner function, it ideally should never get garbage collected, since the inner function 'fun', may be passed as a reference to an external context.So 'fun' should still be able to access 'a', from the external context. If my understanding is correct, how does garbage collection happen then, and how does it ensure to have enough memory space, since keeping all variables in memory until the execution of the program might not be tenable ?

    Read the article

  • Global variables that can be used in multiple jQuery functions

    - by YouBook
    Can you be able to contain variables that can be used in multiple functions in jQuery, example: var self = $(this); var box = self.parents('.box'); $('#title').click(function() { self.css('background', 'red'); box.slideDown('slow'); }).dblclick(function() { self.css('background', 'green'); box.slideUp('slow'); }); So that self and box can be used within these event functions so I don't have to keep doing this: $('#title').click(function() { var self = $(this); var box = self.parents('.box'); self.css('background', 'red'); }).dblclick(function() { var self = $(this); var box = self.parents('.box'); self.css('background', 'green'); }); But question is, is it possible, if so, how can you do that?

    Read the article

  • Why can't I read session variables

    - by Marty Goetz
    I have a c# .net web application. I create session variables but when I try to read them after I leave the page that they were created from I can't. Created on page 1 Session["UserName"] = "WhatEver"; Then I do Response.Redirect("~/whatever.aspx"); and try to read to read the session variable in the Page_Load method of the new page string userName = Session["UserName"].ToString(); I receive "Object reference not set to an instance of an object." Why am I receiving this error and what can I do to fix the problem? I would greatly appreciate any help anyone can give me.

    Read the article

  • Test-driven Development: Writing tests for private / protected variables

    - by Chetan
    I'm learning TDD, and I have a question about private / protected variables. My question is: If a function I want to test is operating on a private variable, how should I test it? Here is the example I'm working with: I have a class called Table that contains an instance variable called internalRepresentation that is a 2D array. I want to create a function called multiplyValuesByN that multiplies all the values in the 2D array by the argument n. So I write the test for it (in Python): def test_multiplyValuesByN (self): t = Table(3, 3) # 3x3 table, filled with 0's t.set(0, 0, 4) # Set value at position (0,0) to 4 t.multiplyValuesByN(3) assertEqual(t.internalRepresentation, [[12, 0, 0], [0, 0, 0], [0, 0, 0]]) Now, if I make internalRepresentation private or protected, this test will not work. How am I supposed to write the test so it doesn't depend on internalRepresentation but still tests that it looks correct after calling multiplyValuesByN?

    Read the article

  • AS3 function running before variables are defined!

    - by Jeffrey
    I am trying to add an init() function to a MovieClip, but when I run the function from scene1 the variables that were set in the MovieClip are not defined yet... The MovieClip was dragged to the stage from the library. scene1: mc.init(null); MovieClip: var _default = 5; function init(num) { if(num == null) { trace(_default); } else { trace(num); } } This is tracing "undefined" instead of "5"; Is there a way of fixing this problem?

    Read the article

  • Accessing HttpApplication.Application variables from a class

    - by Young Ninja
    I set up various global parameters in Global.asax, as such: Application["PagePolicies"] = "~/Lab/Policies.aspx"; Application["PageShare"] = "/Share.aspx"; Application["FileSearchQueries"] = Server.MapPath("~/Resources/SearchQueries.xml"); ... I have no problem accessing these variables form .ascx.cs or .aspx.cs file -- ie. files that are part of the Web content. However, I can't seem to access 'Application' from basic class objects (ie. standalone .cs files). I read somewhere to use a slight variations in .cs files, as follows, but it always comes throws an exception when in use: String file = (String)System.Web.HttpContext.Current.Application["FileSearchQueries"];

    Read the article

  • pass custom environment variables to System.Diagnostics.Process

    - by Mike Ruhlin
    I'm working on an app that invokes external processes like so: ProcessStartInfo startInfo = new ProcessStartInfo(PathToExecutable, Arguments){ ErrorDialog = false, RedirectStandardError = true, RedirectStandardOutput = true, UseShellExecute = false, CreateNoWindow = true, WorkingDirectory = WorkingDirectory }; using (Process process = new Process()) { process.StartInfo = startInfo; process.Start(); process.BeginErrorReadLine(); process.BeginOutputReadLine(); process.WaitForExit(); return process.ExitCode; } One of the processes I'm calling depends on an environment variable that I'd rather not require my users to set. Is there any way to modify the environment variables that get sent to the external process? Ideally I'd be able to make them visible only to the process that's running, but if I have to programmatically set them system-wide, I'll settle for that (but, would UAC force me to run as administrator to do that?) ProcessStartInfo.EnvironmentVariables is read only, so a lot of help that is...

    Read the article

  • django accessing class variables in a view

    - by dana
    hello, i want to make a notification function, and i need fields from 2 different models. how can i access those fields? in my notification view i wrote this data = Notices.objects.filter(last_login<date_follow) where last_login belongs to the model class User , and date_follow to Follow but it is not a proper and correct way of accessing those variables. How can i access them? I need to compare the two dates for realising the notifications that one did not see since his last login. Thanks!

    Read the article

  • Environment Variables in C

    - by tpar44
    I know this type of question has been asked a lot but none of the answers seem to help. I set an environment variable through setenv() function call in Ubuntu Linux. However, the program doesn't seem use this environment variables. If I use getenv() it gets the correct value but the output to the program is wrong. However, when I use export BLOCKSIZE=512 in the shell, the output to the program is correct. I am not spawning different processes from the program. Below is only a code snippet of what I am doing, it is not my whole program. Is there any reason for this?

    Read the article

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