Search Results

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

Page 38/552 | < Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >

  • Android use of an string array on another method

    - by spagi
    Hi all. Im trying to make an activity that has a multiple choice dialog after you push a button. In there you select from a list of things. But these things are received from a web method before the dialog appears. So I create a string array after I receive them inside the onCreate to initialise it there with the correct size. But my dialog method then cant get the array because propably its out of its scope. My code looks like this @Override protected Dialog onCreateDialog(int id) //Here is where the array is loaded to the multiple select dialog etc @Override public void onCreate(Bundle savedInstanceState) //Here is where i initialise the array and get its contents etc I cant initialise my array when the class starts because I dont know its size yet. This has to do something with the scopes of my variables and I am pretty confused

    Read the article

  • Does python have a session variable concept???

    - by gizgok
    I have a datetime.date variable in python.I need to pass it to a function do operations according to the date given and then increment the date for the next set of operations.The problem is I have to do the operations in diff pages and hence I need the date as a variable which can go from page to page. Can we do this in python.......

    Read the article

  • Environment variable expansion in persistence.xml (JPA)

    - by user342495
    I am developing a Eclipse RCP plugin which uses JPA. I tried to specify the database path via a variable give to the JVM on runtime. The property is set correctly but the database is created in a folder named after the variable name (here: ${DBHOME}). <property name="javax.persistence.jdbc.url" value="jdbc:derby:${DBHOME};create=true"/> Is there a possibility to fix this? Thx

    Read the article

  • Variable type for Application on Time Events [on hold]

    - by user2931226
    Been Trying to figure out how to go about setting a Variable for some Application On Time events, But still not confident to do it. These events (Macro's) get called by another Macro then they wait for 10 - 20 minutes, then they don't Run. So have read that (EarliestTime argument) should be assigned to a variable to store it other wise it looses it when other things are running Help appreciated Thanks Sub settimers() Application.OnTime TimeValue(Range("$X$9").Text), "StartBlink" Application.OnTime TimeValue(Range("$W$11").Text), "StopBlink" End Sub

    Read the article

  • mysql -e option with variable data - Pass the variable value to insert sql statement in shell script

    - by Ahn
    The following shell script is not inserting the data to the table. How to pass the variable value to insert sql statement in a shell script. id=0 while true do id=`expr $id + 1`; mysql -u root -ptest --socket=/data/mysql1/mysql.sock -e 'insert into mytest1.mytable2(id,name) values (' $id ',"testing");' echo $id >> id.txt done I have modified the script as below and tried, and still having the issue id=0 while true do id=`expr $id + 1`; # mysql -u root -ptest --socket=/data/mysql1/mysql.sock1 -e 'insert into mytest1.mytable1(name) values ("amma");' mysql -u root -ptest --socket=/data/mysql1/mysql.sock -e 'insert into mytest1.mytable2(id,name) values ( $id ,"testing");' echo $id >> id.txt done error : ]$ ./insert ERROR 1054 (42S22) at line 1: Unknown column '$id' in 'field list'

    Read the article

  • JavaScript's Associative Array / Object can't be read in functions

    - by Matrym
    At the very beginning of the javascript file, I have: var lbp = {}; lbp.defaults = { minLength: 40 }; I can successfully alert it afterwards, with: alert(lbp.defaults.minLength); But as soon as I put it inside a function, when I alert, I get "Undefined". What gives, and how do I avoid this? Is it absolutely necessary to pass this variable into each function, for example, by doing: function(lbp) { alert(lbp.defaults.minLength); } I would have thought that defining it first, it would attain global scope and not be required to be passed in? Thanks in advance for enlightening me :)

    Read the article

  • Quetion regarding local and global variable in javascript

    - by caramel1991
    Today,I started to code a page that prompt the user to choose their PC spec,and the code is as follow <html> <title>Computer Specification Chooser</title> <head> <script type="text/javascript"> var compSpec = document.compChooser; function processorUnavailable_onclick() { alert("Sorry that processor speed is currently unavailable"); compSpec.processor[2].checked = true; } </script> </head> <body> <form name="compChooser"> <p>Tick all components you wan included on your computer</p> <p> DVD-ROM <input type="checkbox" name="chkDVD" value="DVD-ROM" /> <br /> CD-ROM <input type="checkbox" name="chkCD" value="CD-ROM" /> <br /> Zip Drive <input type="checkbox" name="chkZIP" value="ZIP DRIVE" /> </p> <p> Select the processor speed you require <br /> <input type="radio" name="processor" value="3.8" /> 3.8 GHZ <input type="radio" name="processor" value="4.8" onclick="processorUnavailable_onclick()" /> 4.8 GHZ <input type="radio" name="processor" value="6" /> 6 GHZ </p> <input type="button" name="btnCheck" value="Check Form" /> </form> </body> </html> The problem I'm facing is on the function that I've tie to the event handler,when I try to choose the radio button of the processor value 4.8 GHZ,yes it alert me with the message inside the function,but after that,it doest not execute the next statement inside the function,that is to check the next processor value 6 GHZ,I've try my effort to change it and test on it,and find out when I set the var compSpec = document.compChooser as a local variable inside the function instead of a global variable,the next statement could be executed.But I thought for a global variable,it is accessible in everywhere on the page and also inside a function.But why now I can't accesses it inside my function??Any idea??Besides,I stumble upon a weird article while googling,it says that when a global variable is created,it is added to window object.I just curious why this happen??And what's the benefits and uses of it??THANK YOU

    Read the article

  • Why do we use to talk about addresses and memory of variable in C?

    - by user2720323
    Why do we use to talk about addresses and memory of variable in C, where in other languages (like in Java, .Net etc) we do not talk about variable address and memory in a program, we will directly use the variables. But in C Language we are listening the word address and memory. How to explain this? I hope C is high level language designed over the assembly language. So C is a thin layer over assembly language (in assembly language we will use memory locations to store a variable and track a variable). But in other languages these addresses and memory related things are wrapped in that specific language, so that we will not listen these words.

    Read the article

  • When to rewrite vs. upgrade?

    - by MrGumbe
    All custom legacy software needs changing, or so say our users. Sometimes they want a feature or two added and all that is necessary to change a bit of code, add a control, or some other minor upgrade task. Sometimes they want to ditch their error-prone VB5 desktop solution and rewrite the whole thing as a rich Web 2.0 ASP.NET MVC application. More often, however, the scope of changes to legacy functionality lies somewhere between these two extremes. What rules of thumb to you use to decide whether you should upgrade an existing application or start from scratch?

    Read the article

  • why my array is losing it's contents when I refresh the page?

    - by Fernando SBS
    I have created an: var checkboxFarm = new Array(); then I want to record a checkbox status in that array, as there are 11 checkboxes. Button.addEventListener("click", function() { rp_farmAtivada(index); }, false); when clicked change the variable in the array: function rp_farmAtivada(index) { checkboxFarm[index] = !checkboxFarm[index]; }; but every time I refresh the page it loses all the checkboxes status and I'm aware that all that array gets the "undefined" value. the checkboxFarm array is defined in the beginning of the script, so it should have a global scope. Am I missing something?

    Read the article

  • Zend Framework: View variable in layout script is always null

    - by understack
    I set a view variable in someAction function like this: $this->view->type = "some type"; When I access this variable inside layout script like this: <?php echo $this->type ?> it prints nothing. What's wrong? My application.ini settings related to layout resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/" resources.layout.layout = "layout" ; changed 'default' to 'layout'

    Read the article

  • ViewState Vs Session ... maintaining object through page lifecycle

    - by Kyle
    Can someone please explain the difference between ViewState and Session? More specifically, I'd like to know the best way to keep an object available (continuously setting members through postbacks) throughout the lifecycle of my page. I currently use Sessions to do this, but I'm not sure if it's the best way. For example: SearchObject searchObject; protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { searchObject = new SearchObject(); Session["searchObject"] = searchObject; } else { searchObject = (SearchObject)Session["searchObject"]; } } that allows me to use my searchObject anywhere else on my page but it's kind of cumbersome as I have to reset my session var if I change any properties etc. I'm thinking there must be a better way to do this so that .NET doesn't re-instantiate the object each time the page loads, but also puts it in the global scope of the Page class? Please advise. TIA

    Read the article

  • Troubles with a PHP session variable after form submission

    - by Psyche
    Hello, I'm setting a PHP session variable with a success message for a HTML form that I'm submitting. If there are no form errors, I redirect to the same page (using header()) and display the message from the session variable. Everything is fine until here, but if I access that page again after submission, the message is still there. Is it possible to make it appear only when I redirect after a successful submit? Thank you.

    Read the article

  • Perl ENV variable contains newline and tab

    - by Michael
    Say I have an environment variable myvar myvar=\tapple\n when the following command will print out this variable perl -e 'print "$ENV{myvar}"' I will literally have \tapple\n, however, I want those control chars to be evaluated and not escaped. How would I achieve it? In the real world $ENV residing in substitution, but I hope the answer will cover that.

    Read the article

  • An object reference is required for the non-static field, method, or property using global variable

    - by Jose Cardama
    Hello Iam working in a global int in which a variable will be used later. I've made the global variable like this: class Foo { public static int stream = Bass.BASS_StreamCreateFile(path1.Text, 0, 0, BASSFlag.BASS_DEFAULT); } which will be later called like this: Foo.stream and it can also contain more then 1 stream for example stream20,30,etc... The problem here is that it returns me this error: "An object reference is required for the non-static field, method, or property" where I call the text in path1.Text How do I fix this?

    Read the article

  • How to find Junit tests that are using a given Java method directly or indirectly

    - by IT-Worx
    Assume there are Java project and Junit project in an Eclipse workspace. And All the unit tests are located in the Junit project and dependent on the application Java project. When making changes to a Java method, I need to find the unit tests that are using the method directly or indirectly, so that I can run the corresponding tests locally in my PC before checking into source control. I don't want to run the entire junit project since it takes time. I could use Eclipse call hierarchy to expand caller methods one by one until I find a test method. But for a project including more than 1 million lines of source code, digging down the call hierarchy takes time too. The search scope within call hierarchy view doesn't seem help much. Appreciate any help.

    Read the article

  • How to free static member variable in C++?

    - by user299831
    Can anybody explain how to free memory of a static member Variable? In my understanding it can only be freed if all the instances of the class are destroyed. I am a little bit helpless at this point... Some Code to explain it: class ball { private: static SDL_Surface *ball_image; }; //FIXME: how to free static Variable? SDL_Surface* ball::ball_image = SDL_LoadBMP("ball.bmp");

    Read the article

  • Where to export a truly global environment variable?

    - by Socio
    I want to set an environment variable that will be visible to all processes launched by Upstart. This is on a CentOS system, but I presume the same applies to Ubuntu given that they both use Upstart. Somewhere in /etc/init/ perhaps? Note that adding it in /etc/profile.d only applies to login shells. I want all processes (e.g cron, rc.local, etc) to see it. Obviously I'd prefer not to edit existing sys config files if it can be avoided.

    Read the article

  • Do there exist programming languages where a variable can truly know its own name?

    - by Job
    In PHP and Python one can iterate over the local variables and, if there is only once choice where the value matches, you could say that you know what the variable's name is, but this does not always work. Machine code does not have variable names. C compiles to assembly and does not have any native reflection capabilities, so it would not know it's name. (Edit: per Anton's answer the pre-processor can know the variable's name). Do there exist programming languages where a variable would know it's name? It gets tricky if you do something like b = a and b does not become a copy of a but a reference to the same place. EDIT: Why in the world would you want this? I can think of one example: error checking that can survive automatic refactoring. Consider this C# snippet: private void CheckEnumStr(string paramName, string paramValue) { if (paramName != "pony" && paramName != "horse") { string exceptionMessage = String.Format( "Unexpected value '{0}' of the parameter named '{1}'.", paramValue, paramName); throw new ArgumentException(exceptionMessage); } } ... CheckEnumStr("a", a); // Var 'a' does not know its name - this will not survive naive auto-refactoring There are other libraries provided by Microsoft and others that allow to check for errors (sorry the names have escaped me). I have seen one library which with the help of closures/lambdas can accomplish error checking that can survive refactoring, but it does not feel idiomatic. This would be one reason why I might want a language where a variable knows its name.

    Read the article

  • Setting Environment Variable for Tomcat 6 Servlet

    - by amaevis
    I'm using Ubuntu's default installation of Tomcat 6. I'm deploying a ROOT.war, and trying to set an environment variable specific to it, i.e. accessible from System.getenv() in the Servlet.init(config). According to the docs (http://tomcat.apache.org/tomcat-6.0-doc/config/context.html), I can specify this in a Context element in conf/Catalina/localhost/ROOT.xml. I've created that with these contents: <Context> <Environment name="FOO" value="bar" type="java.lang.String" override="false"/> </Context> And I've deployed the webapp as usual, i.e. to webapps/ROOT.war. Server.getenv("FOO") in the Servlet.init(config) still returns null. What am I missing?

    Read the article

< Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >