Search Results

Search found 11238 results on 450 pages for 'miserable variable'.

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

  • Variable declarations following if statements

    - by Anthony Pegram
    An issue came up on another forum and I knew how to fix it, but it revealed a feature of the compiler peculiar to me. The person was getting the error "Embedded statement cannot be a declaration or labeled statement" because they had a declaration of a variable following an if statement with no brackets. That was not their intent, but they had commented out the line of code immediately following the if statement, which made the variable declaration the de facto line of code to execute. Anyway, that's the background, which brings me to this. The following code is illegal if (true) int i = 7; However, if you wrap that in brackets, it's all legal. if (true) { int i - 7; } Neither piece of code is useful. Yet the second one is OK. What specifically is the explanation for this behavior? I have a hypothesis, but I'd rather ask the brilliant people on stackoverflow.

    Read the article

  • Using a variable name in XMLHttpRequest

    - by Paul
    Hi All, I am using jQuery and trying to load a variable in place of a named xml file. My Code: $(document).ready(function() { // bind 'myForm' and provide a simple callback function $('#theForm').ajaxForm(function(responseXML2) { var myxml = responseXML2; alert(responseXML2); displayResult(); }); }); function loadXMLDoc(dname) { if (window.XMLHttpRequest) { alert("loading xmlhttprequest"); xhttp=new XMLHttpRequest(); } else { alert("loading activeX"); xhttp=new ActiveXObject("Microsoft.XMLHTTP"); } alert("bottom load"); xhttp.open("GET",dname,false); xhttp.send(); return xhttp.responseXML; } function displayResult() { alert("setting vars"); alert("displayResult called"); //xml=loadXMLDoc(responseXML2); //tried this and the line below, among others xml=responseXML2; alert("xmlDocLoaded"); xsl=loadXMLDoc("xslt-test.xsl"); alert("XSLloaded"); // code for IE if (window.ActiveXObject) { alert("IE"); ex=xml.transformNode(xsl); document.getElementById("ieiresponse").innerHTML=ex; } // code for Mozilla, Firefox, Opera, etc. else if (document.implementation && document.implementation.createDocument) { alert("notIE"); xsltProcessor=new XSLTProcessor(); xsltProcessor.importStylesheet(xsl); resultDocument = xsltProcessor.transformToFragment(xml,document); document.getElementById("ieiresponse").appendChild(resultDocument); } } In the code above I want to have: //xml=loadXMLDoc(responseXML2); //tried this and the line below, among others xml=responseXML2; instead of a named file: xsl=loadXMLDoc("example.xml"); When I run through the code, it works if I name the file, but when I use the variable, (which does show up in alerts, so is being pulled), it stops the code at the above line (placing the variable as the xml file) Any help would be much appreciated! Thank you in advance.

    Read the article

  • make a variable final in Android Studio

    - by user3664685
    When I try to make the variable A(String) equal to e(Which comes from a Plain Text) this appears in the line of the error(In the code below): Variable 'e' is accessed from within inner class, needs to be declared final. I don't know how to make 'e' final. public void MORSE(View v) { EditText e=(EditText)findViewById(R.id.text); TextView T=(TextView)findViewById(R.id.translation); Button TRAD=(Button) findViewById(R.id.translate); TRAD.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view){ String A; A=""+e; //HERE IS THE ERROR. } }); }

    Read the article

  • Search for Variable Usage In SSIS tasks

    - by yoni.s
    Hi all: As what seems to be some sort of penance for sins in a prior life, I have been tasked with maintaining some SSIS packages. (NO! NO BADMOUTHING SSIS!! BAD PROGRAMMMER! NO DOUGHNUT!). Anyhoo, I many of the packages have variables, defined in an outer container, which are used in multiple inner containers, in script tasks. What I want to do, is find out all the places in a package a variable being used; in other words, search for instances of variable usage in all tasks of a package. This would be a huge help, but I cannot for the life of me find out how this can be done in BIDS. (this is SSIS/BIDS 2008) Thanks for any help, YS

    Read the article

  • Assigning values to variable WHILE loop

    - by Milaan
    Hi! I have a WHILE loop that loops through a table as long as $i is less than 10. I want this loop to assign the INNERHTML of each cell to a variable. So that I can use it later on to process the information (the loop is because you can choose if it has to take first 3 or first 10 cells). But how do I assign every innerHTML to a different variable? I'm sure there has to be an easy way. But google couldn't get me a good answer. Thanks in advance! Milaan

    Read the article

  • Change Makefile variable value

    - by paulgray
    Is there a way to reassign Makefile variable value inside of the target body? What I am trying to do is to add some extra flags for debug compilation: %.erl: %.beam $(ERLC) $(ERLFLAGS) -o ebin $< test: clean debug_compile_flag compile compile_test debug_compile: $(ERLCFLAGS) += -DTEST So if I invoke test target I would like to clean up my environment, add some new flags (like -DTEST to the existing ones), compile the whole code once again (first sources, then test modules). I do not want to copy/paste the code for compiling with some new flags set since there is a lot of logic put here and there. Is there some easy way to redefine the variable value so I can reuse the existing code?

    Read the article

  • Use the long reserved word as a variable name in C#

    - by Mark Pearl
    Hi... a bit of an unusual one.. but I was wondering if anyone knew how I could declare a reserved word as a variable. I have the following code, but it does not like my use of the long variable name. I know I could rename it, but for instrest sakes I would like to know if this is at all possible. private string lat; private string long; public string Lat { get { return lat; } } public string Long { get { return long; } }

    Read the article

  • I18n - JSF variable value translation

    - by Yurish
    Hi! I am using Bundle Internationalization in my project. I have initialized bundle via <f:loadBundle basename="ui.all.bundles.AppResources_en" var="msg"/> When i need to translate some text, i am using a key to resourceBundle, to get a value of it, for example: #{msg.someText}. But, now i want to translate text, which key is a value of another variable. For example: I have variable String textToTransl. It`s value is status_booked. In my AppResources is defined, that status_booked means "It is booked!", so, when i am pointing it to #{msg.textToTransl} i need to see "It is booked!" How can i make it work?

    Read the article

  • Pro/con: Initializing a variable in a conditional statement

    - by steffenj
    In C++ you can initialize a variable in an if statement, like so: if (CThing* pThing = GetThing()) { } Why would one consider this bad or good style? What are the benefits and disadvantages? Personally i like this style because it limits the scope of the pThing variable, so it can never be used accidentally when it is NULL. However, i don't like that you can't do this: if (CThing* pThing = GetThing() && pThing->IsReallySomeThing()) { } If there's a way to make the above work, please post. But if that's just not possible, i'd still like to know why. Question borrowed from here, similar topic but PHP.

    Read the article

  • Memory address of a variable

    - by dotnetvoyager
    Hi Everyone, Is it possible to get the memory address of a variable in C#. What I am trying to do is very simple. I want to declare variables of type Double, Float, Decimal and assign the value 1.1 to each of these variables. Then I would like to go and see how these values are represented in memory. I need to get the memory address of the variable in order to see how its stored in memory. Once I have the memory address I plan to put a break point in the code and use the Debug - Windows - Memory option in visual studio to see how the numbers are stored in memory. Cheers,

    Read the article

  • R data frame select by global variable

    - by Matt
    I'm not sure how to do this without getting an error. Here is a simplified example of my problem. Say I have this data frame DF a b c d 1 2 3 4 2 3 4 5 3 4 5 6 Then I have a variable x <- min(c(1,2,3)) Now I want do do the following y <- DF[a == x] But when I try to refer to some variable like "x" I get an error because R is looking for a column "x" in my data frame. I get the "undefined columns selected" error How can I do what I am trying to do in R?

    Read the article

  • Does this variable need to be declared volatile?

    - by titaniumdecoy
    Does the out variable in the MyThread class need to be declared volatile in this code or will the "volatility" of the stdout variable in the ThreadTest class carry over? import java.io.PrintStream; class MyThread implements Runnable { int id; PrintStream out; // should this be declared volatile? MyThread(int id, PrintStream out) { this.id = id; this.out = out; } public void run() { try { Thread.currentThread().sleep((int)(1000 * Math.random())); out.println("Thread " + id); } catch (InterruptedException e) { e.printStackTrace(); } } } public class ThreadTest { static volatile PrintStream stdout = System.out; public static void main(String[] args) { for (int i = 0; i < 10; i++) { new Thread(new MyThread(i, stdout)).start(); } } }

    Read the article

  • Referring to a non-final variable data inside an inner class

    - by shoaibmohammed
    Im doing a program in GWT. Here is the snippet where Im having problem private String[] populateRSSData() { 1==>> String[] data = null; try { new RequestBuilder(RequestBuilder.GET, "../database.php?action=populaterss").sendRequest(null, new RequestCallback() { @Override public void onResponseReceived(Request request, Response response) { 2==>> data=response.getText().split("~"); } @Override public void onError(Request request, Throwable exception) { Window.alert(exception.getMessage()); } }); } catch (RequestException e) { Window.alert(e.getMessage()); } return data; } Now the problem arises that I get an error that the variable 1==>> data should be declared final. But if I declare it as final then i cannot store the datas in 2==>> The error i get Cannot refer to a non-final variable data inside an inner class defined in a different method RSS_Manager.java Please suggest

    Read the article

  • Using Function return in global variable vb.net

    - by Cold Assassin
    Can't seem to figure out how to use a function return variable in global Dims example code: Public Class Main Dim Path As String = FixPath() Dim fixwrongtxt As String = Path & "tryme.txt" Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load FixPath() On_load() End Sub Private Function FixPath() As String Path = "C:\test" MsgBox(Path) //First Message Box' Return Path End Function Sub On_load() MsgBox(fixwrongtxt) //Second Message Box End Sub End Class when I run it all I get the first message box that contains "C:\test" and I click ok and on the second messagebox I get "custom.dll" with out the "C:\test" or "Path Return" What am I doing wrong? I know I can't use // in vb.net. I have also tried adding "FixPath()" under Sub On_load() but got same result. Also the reason I have to have these global is because I have around 30 Subs that refer to "Path" Variable... Thanks

    Read the article

  • Actionscript 2.0 Functions problem and somewhat "global" variable

    - by Joshua
    I have two problems. The first problem is with the following functions; when I call the function in (enterFrame), it doesn't work: onClipEvent (load) { function failwhale(levelNum) { _root.gotoAndStop("fail"); failFrom = levelNum; } function guardSightCollision(guardName, guardSightName) { if (_root.guardName.guardSightName.hitTest(_x, _y+radius, true)) { failwhale(1); } if (_root.guardName.guardSightName.hitTest(_x, _y-radius, true)) { failwhale(1); } if (_root.guardName.guardSightName.hitTest(_x-radius, _y, true)) { failwhale(1); } if (_root.guardName.guardSightName.hitTest(_x+radius, _y, true)) { failwhale(1); } } } onClipEvent (enterFrame) { guardSightCollision(guard1, guard1Sight); } Why doesn't it work?... The second problem lies in the failFrom variable: function failwhale(levelNum) { _root.gotoAndStop("fail"); failFrom = levelNum; } How do I make failFrom a "global" variable in that it can be accessed anywhere (from actionscript in frames and even movieclips)...Right now, when I try to trace failFrom in a different frame, it is "undefined".

    Read the article

  • Variable might not have been initialized error

    - by David
    When i try to compile this: public static Rand searchCount (int[] x) { int a ; int b ; ... for (int l= 0; l<x.length; l++) { if (x[l] == 0) a++ ; else if (x[l] == 1) b++ ; } ... } I get these errors: Rand.java:72: variable a might not have been initialized a++ ; ^ Rand.java:74: variable b might not have been initialized b++ ; ^ 2 errors it seems to me that i initialized them at the top of the method. Whats going wrong?

    Read the article

  • vba excel: do something every time a certain variable is changed

    - by every_answer_gets_a_point
    im doing a bunch of stuff to the variable St For i = 1 To 30000 Randomize e1 = Rnd e2 = Rnd z1 = Sqr(-2 * Log(e1)) * Cos(2 * 3.14 * e2) z2 = Sqr(-2 * Log(e1)) * Sin(2 * 3.14 * e2) St = So * Exp((r - (sigma ^ 2) / 2) * T + sigma * Sqr(T) * z1) C = C + Application.WorksheetFunction.Max(St - K, 0) St = So * Exp((r - (sigma ^ 2) / 2) * T - sigma * Sqr(T) * z1) C = C + Application.WorksheetFunction.Max(St - K, 0) St = So * Exp((r - (sigma ^ 2) / 2) * T + sigma * Sqr(T) * z2) C = C + Application.WorksheetFunction.Max(St - K, 0) St = So * Exp((r - (sigma ^ 2) / 2) * T - sigma * Sqr(T) * z2) C = C + Application.WorksheetFunction.Max(St - K, 0) Next i how do i get notified every time the variable changes?

    Read the article

  • How to track value of a variable in Eclipse Java Debugger

    - by aveschini
    I would like to track the value of a boolean (not Boolean) variable in the Eclips debugger. I need to know when it does change and, for this, i need to track it's value through all the execution; not only when it is in scope. More particularly i have a class (let's call it myClass) with a boolean member variable called isAvailable. My program instantiate 4 or 5 myClass objects. I am expecting that at the end of the execution the isAvailable value of all of my objects is set to true. Contrarily to my excpectation one of myClass objects has isAvailable set to false. I need to know which (in a lot of) methods is setting isAvailable to false.

    Read the article

  • htaccess rewrite rule issue - not able to get 10th variable - getting 1st variable appended with a 0

    - by sandeepan-nath
    With the following rewrite rule - RewriteRule ^(browse_by_exam)/(classes|packs|tutor_search)/([a-zA-Z0-9.\á\á\â\ä\ã\å\æ\ç\è\é\ê\ë\ì\í\ï\ð\ñ\ò\ó\ô\õ\ö\ø\ù\ú\û\ü\ý\þ\¿\¡\«\»\ÿ\ß\$*!-\=\@#\%\^()_\&{}\;\,\<\?`\~[\|\"\']\\ +]+)/([0-1])/([0-9]+)/([0-9]+)/([0-9]+),([0-9]+),([a-z]+),([a-z]+)?$ index.php?a=$1&type=$2&search_text=$3&new_search=$4&search_exam=$5&search_subject=$6&site=$7&count=$8&column=$9&direction=$10 I am not able to get the 10th variable using $_GET['direction'] in my php code - it returns me the 1st variable appended with a 0 i.e. browse_by_exam0. I read in many places about this thing. Here http://www.digimantra.com/tutorials/advanced-htaccess-for-more-than-10-group-of-backtrack-references/, they have given a workaround for the problem - using %1 instead of $10, but that too is not working. Please help. I am completely blocked.

    Read the article

  • Problem with parsing SQL into table variable

    - by Stanley Ross
    I'm using the following code to read a SQL XML Variable into a table variable. I am getting the following error. " Incorrect syntax near '.'. " Can't quite Figure it out DECLARE @LOBS Table ( LineGUID varchar(40) ) DECLARE @lg xml SET @lg = '<?xml version="1.0" encoding="utf-16" standalone="yes"?> <Table> <LOB> <LineGuid>d6e3adad-8c53-4768-91a3-745c0dae0e08</LineGuid> </LOB> <LOB> <LineGuid>4406db8f-0d19-47da-953b-afc1db38b124</LineGuid> </LOB> </Table>' INSERT INTO @LOBS(LineGUID) SELECT ParamValues.ID.value('.','VARCHAR(40)') FROM @lg.nodes('/Table/LOB/LineGuid') AS ParamValues(ID)

    Read the article

  • Regarding Shell variable

    - by arav
    I need to call another shell script testarg.sh within my main script. This script testarg.sh has arguments ARG1 ,ARG2, ARG3. I need to call up the below way ./testarg.sh -ARG1 -ARG2 -ARG3 ARG1 and ARG3 argument Variables are mandatory ones. If its not passed to the main script then i quit. ARG2 is an optional one. If the ARG2 variable is not set with value or it's not defined then i need not pass it from main script.So i need to call up the below way ./testarg.sh -ARG1 -ARG3 If the value exist for the ARG2 Varibale then i need to call the below way ./testarg.sh -ARG1 -ARG2 -ARG3 Do i need to have a if else statement for checking the ARG2 variable is empty or null. Is there any other way to do it.

    Read the article

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