Search Results

Search found 12457 results on 499 pages for 'variable assignment'.

Page 4/499 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Powershell - Splitting variable into chunks

    - by Andrew
    I have written a query in Powershell interrogating a F5 BIG-IP box through it's iControl API to bring back CPU usage etc. Using this code (see below) I can return the data back into a CSV format which is fine. However the $csvdata variable contains all the data. I need to be able to take this variable and for each line split each column of data into a seperate variable. The output currently looks like this: timestamp,"Utilization" 1276181160,2.3282800000e+00 Any advice would be most welcome $SystemStats = (Get-F5.iControl).SystemStatistics ### Allocate a new Query Object and add the inputs needed $Query = New-Object -TypeName iControl.SystemStatisticsPerformanceStatisticQuery $Query.object_name = $i $Query.start_time = $startTime $Query.end_time = 0 $Query.interval = $interval $Query.maximum_rows = 0 ### Make method call passing in an array of size one with the specified query $ReportData = $SystemStats.get_performance_graph_csv_statistics( (,$Query) ) ### Allocate a new encoder and turn the byte array into a string $ASCII = New-Object -TypeName System.Text.ASCIIEncoding $csvdata = $ASCII.GetString($ReportData[0].statistic_data)

    Read the article

  • one variable and multiple controllers..

    - by Simon
    I'm working on a web application, using the CAKEPHP framework. Herefor i need to request one variable on multiple pages (all pages have different controllers). it is oubvious that i get a error on several pages, since the variable isn't declared in all the different controllers. Is there a workaround for this? i've already tried the app:: import to import a controller in another controller, but this doens't seem to work (still get a undefined variable error). Thnx for your cooperation! Regards, Simon

    Read the article

  • How to permanently change a variable in a Python game loop

    - by Wehrdo
    I have a game loop like this: #The velocity of the object velocity_x = 0.09 velocity_y = 0.03 #If the location of the object is over 5, bounce off. if loc_x > 5: velocity_x = (velocity_x * -1) if loc_y > 5: velocity_y = (velocity_y * -1) #Every frame set the object's position to the old position plus the velocity obj.setPosition([(loc_x + velocity_x),(loc_y + velocity_y),0]) Basically, my problem is that in the if loops, I change the variable from its original value to the inverse of its old value. But because I declare the variable's value at the beginning of the script, the velocity variables don't stay on what I change it to. I need a way to change the variable's value permanently. Thank you!

    Read the article

  • How to change a variable type in C#?

    - by Mosho Mulan
    I wanted to use something like this: if(x==5) { var mydb= ........ ; } else { var mydb = ........ ; } but it didn't work because I can't declare a variable inside if statement. So I tried to do this: var mydb; if (x==5) { mydb= ............. ; } else { mydb=.............; } but id didn't work either because I had to initialize the variable (mydb). So the question is: I don't necessarily know the type of the variable, can I declare it anyway and then change the type inside the if statement?

    Read the article

  • Correct syntax for matching a string inside a variable against an array

    - by Jamex
    Hi, I have a variable, $var, that contains a string of characters, this is a dynamic variable that contains the values from inputs. $var could be 'abc', or $var could be 'blu', I want to match the string inside variable against an array, and return all the matches. $array = array("blue", "red", "green"); What is the correct syntax for writing the code in php, my rough code is below $match = preg_grep($var, $array); (incorrect syntax of course) I tried to put quotes and escape slashes, but so far no luck. Any suggestion? TIA

    Read the article

  • Variable scope problem in JavaScript

    - by dfjhdfjhdf
    I declare a variable with the var word inside a function that handles Ajax requests, then later on in the function I have another function that should change the value of the variable but - my problem - it fails. How to settle the problem down? Here's similiar code I use: function sendRuest(someargums) { /* some code */ var the_variable; /* some code */ //here's that other function request.onreadystatechange = function() { if (request.readyState == 4) { switch (request.status) { case 200: //here the variable should be changed the_variable = request.responseXML; /* a lot of code */ //somewhere here the function closes } return the_variable; } var data = sendRequest(someargums); //and trying to read the data I get the undefined value

    Read the article

  • Android Static Variable Scope and Lifetime

    - by Edison
    I have an application that has a Service uses a ArrayList to store in the background for a very long time, the variable is initialized when the service started. The service is in the background and there will be frequent access to the variable (that's why i don't want to use file management or settings since it will be very expensive for a file I/O for the sake of battery life). The variable will likely to be ~1MB-2MB over its life tie. Is it safe to say that it will never be nulled by GC or the system or is there any way to prevent it? Thanks.

    Read the article

  • Python large variable RAM useage

    - by PPTim
    Hi, Say there is a dict variable that grows very large during runtime- up into millions of key:value pairs. Does this variable get stored in RAM,effectively using up all the available memory and slowing down the rest of the system? Asking the interpreter to display the entire dict is a bad idea, but would it be okay as long as one key is accessed at a time? Tim

    Read the article

  • Accessing MasterPage variable in content page

    - by mattgcon
    I am trying to reference a variable within my MasterPage but I am receiving errors. I have tried <%@ MasterType" %: which gives the following error: `Compiler Error Message: CS0030: Cannot convert type 'IPAMIntranet.IPAMIntranetMaster' to 'ASP.ipamintranetmaster_master' and "string tVar = ((MyNamespace.MyMasterPage)Master).variable" which gives the following error: `Unable to cast object of type 'ASP.ipamintranetmaster_master' to type 'IPAMIntranet.IPAMIntranetMaster'.` Does anyone know what is happening or am I missing something.

    Read the article

  • Variable within variable possible?

    - by JM4
    I am trying to create a loop statement for some of my code and am wondering how I can put a variable within another variable. For example: <?php $j=1; while ($j <= 9): { $f$jfname = $_SESSION['F$jFirstName']; $f$jmi = $_SESSION['F$jMI']; $f$jlname = $_SESSION['F$jLastName']; } $j++; endwhile; ?> Where the goal is to have the j variable increase during the loop and change the values as: $f1fname $f2fname $f3fname and so on. Any ideas?

    Read the article

  • FORTRAN: determine variable type

    - by tibbs
    hello, GOOGLE has yet to find an answer for me, so here goes: In FORTRAN, is there a way to determine the TYPE of a variable? E.G., pass the variable type as an argument in a function, to then be able to call type-specific code with that fuction; eliminating the need to have seperate similar functions for each data type. thanks.

    Read the article

  • send javaScript variable to php variable

    - by mrbunyrabit
    First i thought that i had to convert javascript to php, but then i found out that cant because of server and client side executions. So now I simply want to send ONE variable <script type="text/javascript"> function scriptvariable() { var theContents = "the variable"; } </script> to a php variable <?php $phpvariable ?> That function in the javascript executes when lets say i click on a button. Now i have Nooo idea how to get that phpvariable Equal to the javascript one so i can use that phpvariable to look up stuff in my Database. I know i can add it to my url or some thing, and just refresh the page.. But id like to do it with AJAX as further in my webpage i might have to use this Ajax method.. So is there an easy way to do this without having to dump pages of code on my page to do one simple thing?

    Read the article

  • t-sql get variable value from string with variable name

    - by Markus
    Hi. Is there a way to convert '@my_variable' string into a value of @my_variable? I have a table which stores names of variables. I need to get the value of this variable. Something like this: DECLARE @second_variable AS NVARCHAR(20); DECLARE @first_variable AS NVARCHAR(20); SET @first_variable = '20'; SET @second_variable = SELECT '@first_variable'; --here I want that @second variable be assigned a value of "20".

    Read the article

  • PHP Variable Variable inside []'s

    - by Homer_J
    Hi all, I hope there is a simple solution! I have a variable: $results['q1']; Is it possible to have the 'q1' element as a variable, something like this: $results['$i[question]']; Have not been able to find a solution on Google and researching the PHP manuals... Anyone got a suggestion/ solution? Thanks, Homer.

    Read the article

  • How to increment variable names/Is this a bad idea

    - by tom
    In Python, if I were to have a user input the number X, and then the program enters a for loop in which the user inputs X values, is there a way/is it a bad idea to have variable names automatically increment? ie: user inputs '6' value_1 = ... value_2 = ... value_3 = ... value_4 = ... value_5 = ... value_6 = ... Can I make variable names increment like that so that I can have the number of variables that the user inputs? Or should I be using a completely different method such as appending all the new values onto a list?

    Read the article

  • .htaccess add hidden php get variable for language selection

    - by Eric Di Bari
    I have a multiple language website, and I use a php get variable to set the cookie for the language setting. I have multiple subfolders (http://www.site.com/es and http://www.site.com/de) that each have a respective .htaccess file. When accessing these folders, the .htaccess file does this to "silently" redirect the user and add the appropriate php variable: ------- Options +FollowSymlinks RewriteEngine on RewriteOptions MaxRedirects=10 rewriterule ^http://www.site.com/es/$ http://www.site.com/?l=es [P,R=301] rewriterule ^(.*)$ http://www.site.com/$1?l=es [P,R=301] ------- When someone accesses the root directory: http://www.site.com, I want to add a ?l=en suffix "silently" to the url. How do I do that? Thanks.

    Read the article

  • What's the diffrence btw System property and system environment variable

    - by khue
    Hi all I am not clear about this. When I run a java App or run an Applet in applet viewer,( in the IDE environment), System.getProperty("java.class.path") give me the same as System.getenv("CLASSPATH"), which is the CLASSPATH env variable defined. But when I deploy my applet to webserver and access it from the same computer as a client, I get different result for the two (System.getProperty("java.class.path") only point to jre home and System.getenv("CLASSPATH") return null). And here is some other things that make me wonder: For the applet part, the env var JAVA_HOME, i get the same result when deploying the applet in a browser as well as Applet Viewer. And if I define myself a env variable at system level, and use getenv("envName") the result is null. Is there anyway I can define one and get it in my java program? Thanks a lot Regards K.

    Read the article

  • Ruby on Rails - Adding variable to params[]

    - by miligraf
    In the controller, how can I add a variable at the end of a params[]? If I try this I get an error: params[:group_] + variable How should it be done? Edit per request Ok, I have a form that sets groups of radio buttons with names like this: group_01DRN0 Obviously I have different groups in the form (group_01AAI0, group_01AUI0, etc.) and the value is set according to the radio button selected within the group: Radio button "group_01DRN0" could have value of "21" or "22" or "23", radio button "group_01AAI0" could have value of "21" or "22" or "23", etc. In the DB I have every code (01DRN0, 01AAI0, 01AUI0, etc) so I want to select them from DB and iterate in the params value so I can get the radio button group value, I've tried this with no luck: @codes=Code.get_codes for c in @codes @all=params[:group_] + c.name end Thanks.

    Read the article

  • Java: Checking contents of char variable with if condition

    - by Troy
    Hello, I have a char variable that is supposed to contain either a Y,y,n or N character, I want to test if it does not contain it, then display an error message and exit the program. This is the code I am using; if (userDecision != 'Y' || userDecision != 'y' || userDecision != 'n' || userDecision != 'N') { System.out.println("Error: invalid input entered for the interstate question"); System.exit(0); } Irregardless of what is in the variable it always returns true and executes the command to exit the program, what am I doing wrong?

    Read the article

  • Basic Python: Exception raising and local variable scope / binding

    - by SuperJdynamite
    I have a basic "best practices" Python question. I see that there are already StackOverflow answers tangentially related to this question but they're mired in complicated examples or involve multiple factors. Given this code: #!/usr/bin/python def test_function(): try: a = str(5) raise b = str(6) except: print b test_function() what is the best way to avoid the inevitable "UnboundLocalError: local variable 'b' referenced before assignment" that I'm going to get in the exception handler? Does python have an elegant way to handle this? If not, what about an inelegant way? In a complicated function I'd prefer to avoid testing the existence of every local variable before I, for example, printed debug information about them.

    Read the article

  • C#: How to constuct a variable from another variables

    - by ozzwanted
    How to construct new variable in C#. I mean, to have sth like this public void updateXXX(string endingOfVariable, int newValue) { this.textBox_{endingOfVariable} = newValue; } This is implemented in Php: $a = 'var'; $b = 'iable'; $variable = 'var'; echo ${$a.$b}; But maybe it is possible in C#. The problem is that - I created ~500 textBoxes in C# Windows Form, and if I want to set a value, I need to build a switch() {case:; } statment with 500's cases.

    Read the article

  • PHP pass variable after form is submitted

    - by user342391
    I have a form that posts to process.php. Process.php send all the data to mysql then returns back to the page using: <?php header("Location: /campaigns"); ?> On the page it returns to I want to display a message saying form submitted. Can I post a variable to the Location: /campaigns. And use the variable to display the message (or modal box)? and if so what would be the best way to do it?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >