Search Results

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

Page 96/552 | < Previous Page | 92 93 94 95 96 97 98 99 100 101 102 103  | Next Page >

  • Excel assign copied sheet name as variable

    - by rach-90
    I'm trying to copy an existing sheet in my workbook and then I want to use the copied sheet to run the rest of my code. (Sheet3 is the existing sheet, S_Temp is the copied sheet) Dim s_Temp as string Sheet3.copy Activesheet.name = S_Temp Sheets("S_Temp").Range("A1").value = "Test" How can I reference to the copied sheet?

    Read the article

  • Can i Use the value of a variable from within a ruby script inside ssh.exec()

    - by kamal
    If i have a # {} , like #{results}, in the snippet below: results = Array.new                                   f = open("/Users/kahmed/messages", "r")                                   f.each_line do |line|                                        results << "#{$.} #{line}" if line =~ /NFE/                                       put #{results}                                   end How can i use it in the following ssh.exec command Net::SSH.start( HOST, USER, :password = PASS ) do|ssh|                                   ssh.exec(#{results})

    Read the article

  • Value of variable changing before function is finished running

    - by Patrick
    I have an image uploading script in which i use the following setup to assign names to uploaded images; $saltdate = date( 'U' ); $saltuser = $_SERVER[REMOTE_ADDR]; $saltname = md5($saltdate.$saltuser); // Recieve, Process, Save uploaded image // Update database with image name The problem that i encounter is that after processing/saving the image, when its time to add this file name to the database, the value of $saltdate seems to have changed and i will get a file name in the database that doesnt exist. How can i make sure that the value doesn't change once i establish it?

    Read the article

  • PHP: Parsing of a given form input variable

    - by Jaime Cross
    How would I go about parsing incoming form data where the name changes based on section of site like: <input type="radio" name="Motorola section" value="Ask a question"> where 'Motorola section may be that, or Verizon section, or Blackberry section, etc. I do not have any control over changing the existing forms unfortunately, so must find a way to work with what is there. Basically, I need to be able to grab both the name="" data as well as its coresponding value="" data to be able to populate the email that gets sent properly.

    Read the article

  • How to convert a string to variable name

    - by p1xelarchitect
    I'm loading several external JSON files and want to check if they have been successfully cached before the the next screen is displayed. My strategy is to check the name of the array to see if it an object. My code works perfectly when I check only a single array and hard code the array name into my function. My question is: how can i make this dynamic? not dynamic: (this works) $("document").ready(){ checkJSON("nav_items"); } function checkJSON(){ if(typeof nav_items == "object"){ // success... } } dynamic: (this doesn't work) $("document").ready(){ checkJSON("nav_items"); checkJSON("foo_items"); checkJSON("bar_items"); } function checkJSON(item){ if(typeof item == "object"){ // success... } } here is the a larger context of my code: var loadAttempts = 0; var reloadTimer = false; $("document").ready(){ checkJSON("nav_items"); } function checkJSON(item){ loadAttempts++; //if nav_items exists if(typeof nav_items == "object"){ //if a timer is running, kill it if(reloadTimer != false){ clearInterval(reloadTimer); reloadTimer = false; } console.log("found!!"); console.log(nav_items[1]); loadAttempts = 0; //reset // load next screen.... } //if nav_items does not yet exist, try 5 times, then give up! else { //set a timer if(reloadTimer == false){ reloadTimer = setInterval(function(){checkJSON(nav_items)},300); console.log(item + " not found. Attempts: " + loadAttempts ); } else { if(loadAttempts <= 5){ console.log(item + " not found. Attempts: " + loadAttempts ); } else { clearInterval(reloadTimer); reloadTimer = false; console.log("Giving up on " + item + "!!"); } } } }

    Read the article

  • C# newbie problem with variable types

    - by ile
    int newWidth = 100; int newHeight = 100; double ratio = 0; if (img1.Width > img1.Height) { ratio = img1.Width / img1.Height; newHeight = (int)(newHeight / ratio); } else { ratio = img1.Height / img1.Width; newWidth = (int)(newWidth / ratio); } Image bmp1 = img1.GetThumbnailImage(newWidth, newHeight, null, IntPtr.Zero); bmp1.Save(Server.MapPath("~/Uploads/Photos/Thumbnails/") + photo.PhotoID + ".jpg"); I always get Image with both height and width having same values (100) I am obiously doing something wrong with type conversion?

    Read the article

  • 1120: Why can't it access the variable?

    - by Oden
    I'm new at as3, maybe thats the reason why i don't understand, why the setInterval causes an error. <mx:Script> <![CDATA[ import flash.utils.setInterval; import mx.controls.Alert; [Bindable] public var MyInt:int = 500; setInterval(function():void{ ++MyInt; },1000); ]]> </mx:Script> I have a label where the value of MyInt gets visible, the bind works perfect, i've tested it several ways, and i i create a button it grows the number, but if i use the setInterval function i get an error: Access of undefined property myInt. Why? What does cause this? Please explain it, so I can avoid errors like this. Thanks

    Read the article

  • ajax how to read out $_post variable

    - by alex
    Hi, I am trying to filter/search a database with ajax $.ajax({ type: "POST", url: "filterSearch.php", queryString: qry, success: function(data){ alert( "Data Saved: " + data ); $('#searchResult').html(data); // Fill the search results box } }); Now in filterSearch.php i have the following test codes if(isset($_POST['queryString'])) { echo "TEST"; } if($_POST['runquery']==1) { $sql = "SELECT * FROM fs_vacatures WHERE here-the-like-query?"; $msg = $sql; echo $msg; die(); } die(); But nor TEST or the $sql is return in the alert??

    Read the article

  • Setting variable to value of form [drupal 6]

    - by N Schleder
    I have this form $form['title'] = array( '#type' => 'textfield', '#title' => t('Title of Notice'), '#description' => t('Use_underscores_as_spaces'), '#size' => 30, // '#required' => TRUE ); and I want whatever the user types in to be the value of $test I've tried $test = $form['title']; which gives me $test = array also I've tried $test = current($form['title']); which gives me $test = textfield $form['values']['title'] doesn't work dont know what else to try

    Read the article

  • Laravel Passing variable not working

    - by Friend
    Hello People here is my code i have used in controller... public function bulk() { return View::make('bulk')->with('message','hii there'); } my route file contains... Route::get('bulk',array('uses'=>'HomeController@bulk'))->before('auth'); In my view Iam testing it by ... @if(Session::has('message')) Present @else not Present @endif The page is making a view with the message 'not Present' why is it?? I even tried return Redirect::to('bulk')->with('message','hii there'); I get an erro mesage on Console mypro/public/bulk net::ERR_TOO_MANY_REDIRECTS What could be the problem?? is there any issues with name?? I tried this method earlier which worked fine for me.... :( Iam using Blade Template..

    Read the article

  • Opening a file with a variable as name and checking for undefined values

    - by Harm De Weirdt
    I'm having some problems writing data into a file using Perl. sub startNewOrder{ my $name = makeUniqueFileName(); open (ORDER, ">$name.txt") or die "can't open file: $!\n"; format ORDER_TOP = PRODUCT<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<CODE<<<<<<<<AANTAL<<<<EENHEIDSPRIJS<<<<<<TOTAAL<<<<<<< . format ORDER = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<< @<<<< @<<<<<< @<<<<< $title, $code, $amount, $price, $total . close (ORDER); } This is the sub I use to make the file. (I translated most of it.) The makeUniqueFileName method makes a fileName based upon current time("minuteshoursdayOrder"). The problem now is that I have to write to this file in another sub. sub addToOrder{ print "give productcode:"; $code = <STDIN>; chop $code; print "Give amount:"; $amount = <STDIN>; chop $amount; if($inventory{$code} eq undef){ #Does the product exist? print "This product does not exist"; }elsif($inventory{$code}[2] < $amount && !defined($inventaris{$code}[2]) ){ #Is there enough in the inventory? print "There is not enough in stock" }else{ $inventory{$code}[2] -= $amount; #write in order file open (ORDER ">>$naam.txt") or die "can't open file: $!\n"; $title = $inventory{$code}[0]; $code = $code; $amount = $inventory{$code}[2]; $price = $inventory{$code}[1]; $total = $inventory{$code}[1]; write; close(ORDER); } %inventory is a hashtable that has the productcode as key and an array with the title, price and amount as value. There are two problems here: when I enter an invalid product number, I still have to enter an amount even while my code says it should print the error directly after checking if there is a product with the given code. The second problem is that the writing doesn't seem to work. It always give's a "No such file or directory" error. Is there a way to open the ORDER file I made in the first sub without having to make $name not local? Or just a way to write in this file? I really don't know how to start here. I can't really find much info on writing a file that has been closed before, and in a different sub. Any help is appreciated, Harm

    Read the article

  • Error "initializer element is not constant" when trying to initialize variable with const

    - by tomlogic
    I get an error on line 6 (initialize my_foo to foo_init) of the following program and I'm not sure I understand why. typedef struct foo_t { int a, b, c; } foo_t; const foo_t foo_init = { 1, 2, 3 }; foo_t my_foo = foo_init; int main() { return 0; } Keep in mind this is a simplified version of a larger, multi-file project I'm working on. The goal was to have a single constant in the object file, that multiple files could use to initialize a state structure. Since it's an embedded target with limited resources and the struct isn't that small, I don't want multiple copies of the source. I'd prefer not to use: #define foo_init { 1, 2, 3 } I'm also trying to write portable code, so I need a solution that's valid C89 or C99. Does this have to do with the ORGs in an object file? That initialized variables go into one ORG and are initialized by copying the contents of a second ORG? Maybe I'll just need to change my tactic, and have an initializing function do all of the copies at startup. Unless there are other ideas out there?

    Read the article

  • Variable wont echo

    - by jonnnnnnnnnie
    I have the following code, where the var $username doesn't echo, when you type in a value. //TODO: SET AUTH TOKEN as random hash, save in session $auth_token = rand(); if (isset($_POST['action']) && $_POST['action'] == 'Login') { $errors = array(); //USED TO BUILD UP ARRAY OF ERRORS WHICH ARE THEN ECHOED $username = $_POST['username']; if ($username = '') { $errors['username'] = 'Username is required'; } echo $username; // var_dump($username) returns string 0 } require_once 'login_form.html.php'; ?> login_form is this: <form method="POST" action=""> <input type="hidden" name="auth_token" value="<?php echo $auth_token ?>"> Username: <input type="text" name="username"> Password: <input type="password" name="password1"> <input type="submit" name="action" value="Login"> </form> The auth token part isn't important, it just when I type in a value in username textbox and press the login button, the username wont echo, var_dump returns string (0) and print_r is just blank.

    Read the article

  • Getting every odd variable in a list?

    - by John
    If I make a list in Python and want to write a function that would return only odd numbers from a range 1 to x how would I do that? For example, if I have list [1, 2, 3, 4] from 1 to 4 (4 ix my x), I want to return [1, 3].

    Read the article

  • Codeigniter passing variable to URL

    - by CyberJunkie
    I have a list of posts and an edit link for each. When clicking edit it goes to a page where I can edit the specific post I clicked on. For this I will have to pull from the db the id of the post. Would this be the correct way to do it? <a href="<?php echo site_url("post/edit/$row->id"); ?>">Edit</a> post is my controller, edit is my function, and $row->id should pull the id of the post.

    Read the article

  • Using the same variable across multiple files in C++

    - by Sam152
    In the process of changing some code, I have spilt some functions into multiple files. I have the files controls.cpp and display.cpp and I would like to be able to have access to the same set of variables in both files. I don't mind where they are initialized or declared, as long as the functions in both files can use them. This was not an issue when the functions were in the same file, but now it seems almost impossible after an hour of googling and trying various things.

    Read the article

  • Path variable to mso.dll and msoutl.olb

    - by Stefanie
    Hey, I'm trying to develop a toolbar for Microsoft Outlook. For getting it to work I need mso.dll and msoutl.olb as an import. My problem is: the path is hardcoded , but it varies for every OS and of course if someone doesn't install Office to the default path. I tried it this way http://support.microsoft.com/kb/234788/en-us/ but it didn't work, because I couldn't get the return value I needed (OK, after four type conversions but I thought there had to be a better way ;) ) Thanks for helping

    Read the article

  • Changing the value of a variable

    - by neirpycc
    I'm trying to build a simple scoring app but I'm running into a problem trying to keep it so I don't have to repeat a bunch of code to deal with each 'base' individually. The basic idea is that when I click a button the script will; 1) grab the ID of said button 2) split the ID into two parts - (a) the bases name and (b) the button type (plus/minus) 3) if it's plus - add to the bases score, if it's minus - subtract from the bases score 4) update the assigned div with the new value The part I'm stuck at is adding and subtracting. I can't seem to get this to work. Here is the code: $('.base button').click(function() { var b1Score = 0; var b2Score = 0; var b3Score = 0; var b4Score = 0; var b5Score = 0; var clickedButton = $(this).attr('id'); var buttonInfo = clickedButton.split('-'); var baseClicked = buttonInfo[0]; var baseDirection = buttonInfo[1]; var baseDiv = ('#' + baseClicked); console.log('You clicked ' + clickedButton + '.'); if (baseDirection.indexOf('plus') >= 0) { console.log('Increasing ' + baseClicked + '!'); ++; $(baseDiv).val(); } else { console.log('Decreasing ' + baseClicked + '!'); --; $(baseDiv).val(); } }); ++; and --; are placeholders for where the adding and subtracting needs to happen. I just can't figure out how to get it to add or subtract from the correct value. Any help is appreciated. Thanks.

    Read the article

  • array_multisort and dynamic variable options.

    - by websiteguru
    Im trying to sort any array with array_multisort and everything is working great. However, based on conditions in my script, I need to change the options. So What I have so far is this: array_multisort( $sort1,SORT_ASC, $sort2,SORT_ASC, $sort3,SORT_ASC, $arraytosort ); and what I would like to have is something like this: $dynamicSort = "$sort1,SORT_ASC,$sort2,SORT_ASC,$sort3,SORT_ASC,"; array_multisort( $dynamicSort, $arraytosort ); Any suggestions?

    Read the article

  • Concatenate a table name from a variable in a FROM clause

    - by idieeasy
    I'm trying to use a dynamically generated fully-qualified table name in sql server 2008. For example, this does not work: select max([id]) from @dbName+N'.[T1]' This will give an error like: Msg 102, Level 15, State 1, Line 73 Incorrect syntax near '+'. I know that something like this works: declare @qualifiedTable varchar(200) = @dbName+N'.[T1]' select max([id]) from @qualifiedTable But I have to do this LOTS of times so I would really like to do it in line. Is it possible?

    Read the article

  • Erlang bit syntax variable issue

    - by Jimmy Ruska
    Is there any way to format this so it's a valid expression, without adding another step? <<One:8,_:(One*8)>> = <<1,9>>. * 1: illegal bit size These work <<One:8,_:(1*8)>> = <<1,9>>. <<1,9>> <<Eight:8,_:Eight>> = <<8,9>>. <<8,9>> I'm trying to parse a binary with nested data with list comprehensions instead of stacking accumulators.

    Read the article

  • ID generator with local static variable - thread-safe?

    - by Poseidon
    Will the following piece of code work as expected in a multi-threaded scenario? int getUniqueID() { static int ID=0; return ++ID; } It's not necessary that the IDs to be contiguous - even if it skips a value, it's fine. Can it be said that when this function returns, the value returned will be unique across all threads?

    Read the article

  • pass variable by reference within class? in php

    - by user151841
    I'm working on a hex color class where you can change the color values of any hex code color. In my example, I haven't finished the hex math, but it's not completely relevant to what I'm explaining here. Naively, I wanted to start to do something that I don't think can be done. I wanted to pass object properties in a method call. Is this possible? class rgb { private $r; private $b; private $g; public function __construct( $hexRgb ) { $this->r = substr($hexRgb, 0, 2 ); $this->g = substr($hexRgb, 2, 2 ); $this->b = substr($hexRgb, 4, 2 ); } private function add( & $color, $amount ) { $color += amount; // $color should be a class property, $this->r, etc. } public function addRed( $amount ) { self::add( $this->r, $amount ); } public function addGreen( $amount ) { self::add( $this->g, $amount ); } public function addBlue( $amount ) { self::add( $this->b, $amount ); } } If this is not possible in PHP, what is this called and in what languages is it possible? I know I could do something like public function add( $var, $amount ) { if ( $var == "r" ) { $this->r += $amount } else if ( $var == "g" ) { $this->g += $amount } ... } But I want to do it this cool way.

    Read the article

< Previous Page | 92 93 94 95 96 97 98 99 100 101 102 103  | Next Page >