Search Results

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

Page 45/552 | < Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >

  • 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

  • i need to use string variable in the Proc in sql server database 2005

    - by bassam
    I have this procedure CREATE Proc [dbo].Salse_Ditail -- Add the parameters for the stored procedure here @Report_Form varchar(1) , @DateFrom datetime , @DateTo datetime , @COMPANYID varchar(3), @All varchar(1) , @All1 varchar(1) , @All2 varchar(1) , @All3 varchar(1) , @All4 varchar(1) , @All5 varchar(1) , @Sector varchar(10), @Report_Parameter nvarchar(max) as BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. DECLARE @STRWhere nvarchar(max) IF @All5=0 AND @All4=0 AND @All3=0 AND @All2=0 AND @All1=0 and @All=1 set @STRWhere= N'and Sector_id = @Sector' if @Report_Form =1 or @Report_Form =3 or @Report_Form =4 SELECT RETURNREASONCODEID, SITE,SITE_NAME,Factory_id,Factory_Name,Sector_id,sector_name,Customer_name, Customer_id,ITEMID,ITEMNAME,SALESMANID,SALESMAN_NAME,Net_Qty,Net_Salse,Gross_Sales,Gross_Qty, NETWEIGHT_Gross,NETWEIGHT_salse_Gross,NETWEIGHT_NET,NETWEIGHT_salse_NET,Return_Sales,Free_Good, CollectionAmount FROM hal_bas_new_rep WHERE DATAAREAID =@COMPANYID AND INVOICEDATE >= @DateFrom AND INVOICEDATE <= @DateTo and Report_Activti = @Report_Form if @Report_Form =2 SELECT RETURNREASONCODEID , RETURNREASONDESC, SITE , SITE_NAME , Factory_id , Factory_Name , Sector_id , sector_name , Customer_name , Customer_id , ITEMID , ITEMNAME , SALESMANID , SALESMAN_NAME , Return_Sales FROM dbo.hal_bas_new_rep WHERE DATAAREAID =@COMPANYID AND INVOICEDATE >= @DateFrom AND INVOICEDATE <= @DateTo and Report_Activti = @Report_Form and RETURNREASONCODEID in ( SELECT Val FROM dbo.fn_String_To_Table(@Report_Parameter,',',1) ) /* @STRWhere // question: how can I use the variable here? */ end GO As you see I'm constructing a condition for the WHERE clause in a variable, but I don't know how to use it.

    Read the article

  • PHP Convert variable names to lowercase?

    - by VeeBee
    I have an api listener script which takes in get parameters. But I seem to be having issues when users tend to pass mixed case variable names on the parameters. For example: http://mylistenerurl.com?paramName1=Hello&paramname2=World I need my listener to be flixible in such a way that the variable names will be interpreted case-insensitively or rather still all in lower case like after I process the query string on some function, they are all returned as lower-cased variables: extract(someFunction($_GET)); process($paramname1, $paramname2); Can anybody shed some light on this? *much appreciated. thanks!

    Read the article

  • How to set the URL of a link to a variable using WATIR

    - by Alex
    Using WATIR and Excel, I'd like to take the first row of a table in Excel, visit the URL, then set the 12th link on the page as a variable in the cell next to the cell with the URL, then go to the next line and repeat. I'm stuck on getting the URL of the 12th link on the page to set as a variable that I can feed into the next cell in Excel. Here's what I have and it's not working. worksheet = workbook.WorkSheets(1) # get first workbook #declare test site test_site = worksheet.Range("a2").text #open ie ie = Watir::IE.new #go to test_site ie.goto test_site #find primlink ie.link(:index, 12).text = "primlink" puts primlink Any ideas?

    Read the article

  • Setting an instance variable from a block

    - by c00lryguy
    How would I achieve something like below so that when I set the s variable within the block, it also sets the @subject instance variable in my Topic class? class Topic def subject(&blk) blk.call(@subject) if block_given? @subject unless block_given? end end my_topic = Topic.new p my_topic.subject #=> nil my_topic.subject do |s| s = ['one', 'two', 'three'] s.pop p s #=> ['one', 'two'] end p my_topic.subject #=> nil... want it to be ['one, 'two']

    Read the article

  • variable being weirdly deleted

    - by calccrypto
    im having a weird problem with one variable: its not being recognized but its still printing. i would post my code, but it is massive. the basic idea is: # pseudocode def function(stuff): <do stuff> # These are the only 2 conditions if tag == 3: pka = <a string> if tag == 4: pka = <a string> print pka # (1) print pka # (2) <do stuff not modifying pka> print pka # (3) if pka == 'RSA': <do stuff> elif pka == 'DSA': <do stuff> my code will error at (2). however, it will print out (1), (2), and (3), all of which are the same. is there any general explanation of why this is happening? if my code is really needed, i will post it, but otherwise, i would rather not due to its size update: now the code will error at the if statement after (3), saying UnboundLocalError: local variable 'pka' referenced before assignment even though (1),(2),(3) just printed

    Read the article

  • Is it ok to return a reference of a function scope static variable?

    - by kartik
    I wanted to know if that has any ill effects under any circumsatnce. For ex: Ex1: void* func1() { void* p_ref = NULL; //function scope static variable static int var1 = 2; p_ref = &var1; return p_ref; } Ex2: //file scope static variable static int var2 = 2; void* func2() { void* p_ref = NULL; var2 = 3; p_ref = &var2; return p_ref; } So in the above two cases what is the difference apart from the fact that var1 is function scope and var2 is file scope. Thanks in advance.

    Read the article

  • how to assign to the names() attribute of the value of a variable in R

    - by Tony
    In R, "assign('x',v)" sets the object whose name is 'x' to v. Replace 'x' by the result of applying a text function to a variable x. Then "assign" shows its worth. Unfortunately, "assign(paste('names(','x',')',sep=''),v)" fails. So if 'x' is a variable x, I can set its value, but I can't give it names for its elements. Can one work around this? a parse-eval trick maybe? Thanks.

    Read the article

  • Splitting a string with variable number of spaces VBA

    - by GVBA
    I have a file with a bunch of number in columns. These numbers are separated by variable number of spaces. I want to skip the first line and get all the other lines and separte each number on the line. Finally, I want to write each number on Excel. I've been able to get the lines and write them on Excel but I can't separate each number (I'm getting the whole line as one string). Does any body know how to split a string that has a variable number of spaces? Here is my code. Sub Test() r = 0 With New Scripting.FileSystemObject With .OpenTextFile("C:\Users\User\Desktop\File.tab", ForReading) If Not .AtEndOfStream Then .SkipLine Do Until .AtEndOfStream ActiveCell.Offset(r, 0) = Split(.ReadLine, vbCrLf) r = r + 1 Loop End With End With End Sub

    Read the article

  • How to have dynamic css files depending on struts session variable

    - by MichaelMcCabe
    I have a webpage in which i want the css file to be the same name as a session variable I have set. For example; If the session variable was "blue", i want the page to load the css file blue.css. I tried something below which didnt work, and I'm now stuck. My knowledge of struts is very limited. <LINK rel="stylesheet" type="text/css" href="<html:rewrite page='/css/<c:out value="${brand}"/>.css'/>">

    Read the article

  • Passing a variable to javascript via a link.

    - by Jon
    My website has a javascript variable (addselectedsubdivision) that loads a neighborhood name from a box on the left to a box on the right. I was hoping I could build a link and then us PHP to add the subdivision letter, neighborhood, and city so that when you click on the link it goes right to this page and loads the neighborhood name in the box on the right. However, I can't get the variable to pass to the new page. Any suggestions? Website: http://www.mlsfinder.com/va_rein/jonmcachran/index.cfm?primarySearchType=sold&searchType=subdivision&so=a&domain=www.jonsellsvb.com&subdivision_string=p Example link: <a href="http://www.mlsfinder.com/va_rein/jonmcachran/index.cfm?primarySearchType=sold&searchType=subdivision&so=a&domain=www.jonsellsvb.com&subdivision_string=$firstletter" onLoad="addselectedsubdivision($neighborhood||$city);" target="_blank">

    Read the article

  • Remove specific definitions from a variable in PHP

    - by Amit
    Hi everyone, I have a PHP mail script that validates name, email address, and phone number before sending the mail. This then means that the Name, Email address, and Phone fields are Required Fields. I want to have it so that the Name and EITHER Email or Phone are required. Such that if a name and phone are inputted, it sends the mail, or if a name and an email are inputted, it also sends the email. The way the script works right now is it has several IF statements that check for (1) name, (2) email and (3) phone. Here's an example of an if statement of the code: if ( ($email == "") ) { $errors .= $emailError; // no email address entered $email_error = true; } if ( !(preg_match($match,$email)) ) { $errors .= $invalidEmailError; // checks validity of email $email_error = true; } And here's how it sends the mail: if ( !($errors) ) { mail ($to, $subject, $message, $headers); echo "<p id='correct'>"; echo "?????? ????? ??????!"; echo "</p>"; } else { if (($email_error == true)) { $errors != $phoneError; /*echo "<p id='errors'>"; echo $errors; echo "</p>";*/ } if (($phone_error == true)) { $errors != $emailError; $errors != $invalidEmailError; /*echo "<p id='errors'>"; echo $errors; echo "</p>";*/ } echo "<p id='errors'>"; echo $errors; echo "</p>"; } This doesn't work though. Basically this is what I want to do: If no email address was entered or if it was entered incorrectly, set a variable called $email_error to be true. Then check for that variable, and if it's true, then remove the $phoneError part of the $errors variable. Man I hope I'm making some sense here. Does anyone know why this doesn't work? It reports all errors if all fields are left empty :( Thanks! Amit

    Read the article

  • Passing Global Variable value to Facebook - Gets NULL only

    - by Viral
    hi all friends, I am making a game application in that I want to pass my score on wall of face book. I've completed all the things (the log in and message passing part) but when I passes the score via global variable, I am getting only null as a value and not the score that I want. Is there any way to pass data or string to Face book and write on a wall? My code is (void)viewDidLoad { static NSString* kApiKey = @"be60415be308e2b44c0ac1db83fe486b"; static NSString* kApiSecret = @"4f880c7e100321f808c41b1d3c813dfa"; _session = [[FBSession sessionForApplication:kApiKey secret:kApiSecret delegate:self] retain]; score = [NSString stringWithFormat:@"%@",appDelegate.myTextView]; [_session resume]; [super viewDidLoad]; } whre score is NSString and myTextView is NSString in other viewcontrollerfile, And appDelegate is global variable. Any help?? thanks in advance.

    Read the article

  • Check if a variable is empty

    - by Thomas
    I have some user-submitted variables that I want to display in a different part of my site like this: <div class="pre_box">Term: </div> <div class="entry"><?php $key='term'; echo get_post_meta($post->ID, $key, true); ?></div> Occasionally, these variables might be empty in which case I don't want to display the label for the empty variable. In the example above I would want to hide the <div class="pre_box">Term: </div> part. Is there some simple way to check if a php variable like the one above is empty and prevent the label from being displayed?

    Read the article

  • use Variable on VBS

    - by Amirreza
    I Convert a reg file to VBS commands. [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run] @="" "VPService"="C:\\Windows\\System32\\VPService.exe" but i can't use %systemroot% variable instead C:\Windows\ on this. Option Explicit Dim objShell Set objShell = CreateObject("WScript.Shell") Dim strComputer, ArrOfValue, oReg const HKEY_USERS = &H80000003 const HKEY_LOCAL_MACHINE = &H80000002 const HKEY_CURRENT_USER = &H80000001 const HKEY_CLASSES_ROOT = &H80000000 strComputer = "." Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") objShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Run\", "" objShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Run\", "", "REG_SZ" 'Default value objShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Run\VPService", "C:\\Windows\\System32\\VPService.exe", "REG_SZ" Set objShell = Nothing WScript.Quit how can use %systemroot% variable instead C:\Windows\ on this code?

    Read the article

  • Tkinter change all color when variable change

    - by Morten Larsen
    hi i have a simpel tkinter window. consists of a small window, a timer, and a button for set timer. dont want to go in details with the code... Now all the widgets in my windows eg. button, Label Ect. will have to change color. EG. i Have a global variabel wich i will set as color "red" fx... All the widgets BACKGROUND option is associated with the global variabel. Now on button press i will change the global variable to "green" so that the background of all widgets ect. will change color, but they DONT. i thought the .mainloop() sort of UPDATED the window. how can i have the widgets to change background color when my variable change WITHOUT restarting my application??? ty Xanthar

    Read the article

  • Can't echo jquery (with ajax) variable in php

    - by Lars Kerff
    I'm trying to post a variable through ajax. But it won't echo the variable in php. This are the variables (these are working, seen in the log): $("#slider").bind("valuesChanged", function(e, data){console.log("min: " + data.values.min + " max: " + data.values.max);}); The Ajax part: $("#slider").bind("valuesChanged", function (e, data) { $.ajax({ type: "POST", dataType: "text", url: "../test.php", data: { minValue: data.values.min, maxValue: data.values.max }, async: false, success: function(data){ alert('yeah') }, error: function(xhr) { alert('fail') // if your PHP script return an erroneous header, you'll land here } }); }); </script> And php echo: <?php if ( $_POST ) { echo $_POST[ 'minValue' ]; } ?> Now why does it not echo the post? Thanks!

    Read the article

  • Shell script variable problem

    - by user280288
    Hi all, I'm trying to write a shell script to automate a job for me. But i'm currently stuck. Here's the problem : I have a variable named var1 (a decreasing number from 25 to 0 and another variable named var${var1} and this equals to some string. then when i try to call var${var1} in anywhere in script via echo it fails. I have tried $[var$var1], ${var$var} and many others but everytime it fails and gives the value of var1 or says operand expected error. Thanks for your help

    Read the article

< Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >