Search Results

Search found 13563 results on 543 pages for 'condition variable'.

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

  • 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

  • PHP: Assigning values to a variable inside IF statement

    - by Matt
    Hi guys, I was wondering if i could assign values to a variable inside an IF statement. My code is as follows: <?php if ((count($newArray) = array("hello", "world")) == 0) { // do something } ?> So basically i want assign the array to the $newArray variable, then count newArray and check to see if it is an empty array. I know i can do this on several lines but just wondered if i could do it on one line Thanks M

    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

  • Atomic Instructions and Variable Update visibility

    - by dsimcha
    On most common platforms (the most important being x86; I understand that some platforms have extremely difficult memory models that provide almost no guarantees useful for multithreading, but I don't care about rare counter-examples), is the following code safe? Thread 1: someVariable = doStuff(); atomicSet(stuffDoneFlag, 1); Thread 2: while(!atomicRead(stuffDoneFlag)) {} // Wait for stuffDoneFlag to be set. doMoreStuff(someVariable); Assuming standard, reasonable implementations of atomic ops: Is Thread 1's assignment to someVariable guaranteed to complete before atomicSet() is called? Is Thread 2 guaranteed to see the assignment to someVariable before calling doMoreStuff() provided it reads stuffDoneFlag atomically? Edits: The implementation of atomic ops I'm using contains the x86 LOCK instruction in each operation, if that helps. Assume stuffDoneFlag is properly cleared somehow. How isn't important. This is a very simplified example. I created it this way so that you wouldn't have to understand the whole context of the problem to answer it. I know it's not efficient.

    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

  • 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

  • If-statement: how to pull 2nd GET variable

    - by arsoneffect
    How do I get this to pull my 2nd variable? (I already have a switch setup) <body id="<?php if (! isset($_GET['page'])) { echo "home"; } else { $_GET['page']; echo $page; } ?>"> I have a switch statement that pulls the pages from index.php?page=##### and I have just added this part to my switch: index.php?page=####&section=##### Right now, if I am on page=photos, my code ends up being: <body id="photos"> I need to make it so that if any link has the "sections" variable on it like this page=photos&section=cars it uses the same ID: <body id="photos">

    Read the article

  • [C] Programming problem: Storing values of an array in one variable

    - by OldMacDonald
    Hello, I am trying to use md5 code to calculate checksums of file. Now the given function prints out the (previously calculated) checksum on screen, but I want to store it in a variable, to be able to compare it later on. I guess the main problem is that I want to store the content of an array in one variable. How can I manage that? Probably this is a very stupid question, but maybe somone can help. Below is the function to print out the value. I want to modify it to store the result in one variable. static void MDPrint (mdContext) MD5_CTX *mdContext; { int i; for (i = 0; i < 16; i++) { printf ("%02x", mdContext->digest[i]); } // end of for } // end of function For reasons of completeness the used struct: /* typedef a 32 bit type */ typedef unsigned long int UINT4; /* Data structure for MD5 (Message Digest) computation */ typedef struct { UINT4 i[2]; /* number of _bits_ handled mod 2^64 */ UINT4 buf[4]; /* scratch buffer */ unsigned char in[64]; /* input buffer */ unsigned char digest[16]; /* actual digest after MD5Final call */ } MD5_CTX; and the used function to calculate the checksum: static int MDFile (filename) char *filename; { FILE *inFile = fopen (filename, "rb"); MD5_CTX mdContext; int bytes; unsigned char data[1024]; if (inFile == NULL) { printf ("%s can't be opened.\n", filename); return -1; } // end of if MD5Init (&mdContext); while ((bytes = fread (data, 1, 1024, inFile)) != 0) MD5Update (&mdContext, data, bytes); MD5Final (&mdContext); MDPrint (&mdContext); printf (" %s\n", filename); fclose (inFile); return 0; }

    Read the article

  • Checking negative of a condition

    - by oym
    What is the (slightly pejorative) term for checking the negative of a condition (rather than the positive which is often more readable): e.g. if(!someVar) { return null; } else { return doSomethingInteresting(); } instead of doing this (which is arguably more readable) if(someVar) { return doSomethingInteresting(); } else { return null; } I vaguely remember there being a term for this; something in the same spirit as the term Yoda conditions.

    Read the article

  • How to provide a date variable an interval that consists of an integer variable in Postgresql

    - by Lucius Rutilius Lupus
    I am trying to extract an amount of years from a specific date for this the correct syntax is <date> - interval '5 years'; But I dont want to extract a specific amount of years but a variable, which user will provide as a parameter. I have tried the following the variable name is years : date+interval '% years',years; I am getting an error and it doesn't let me do it that way. What would be the right way to do it.

    Read the article

  • Assigning a variable of a struct that contains an instance of a class to another variable

    - by xport
    In my understanding, assigning a variable of a struct to another variable of the same type will make a copy. But this rule seems broken as shown on the following figure. Could you explain why this happened? using System; namespace ReferenceInValue { class Inner { public int data; public Inner(int data) { this.data = data; } } struct Outer { public Inner inner; public Outer(int data) { this.inner = new Inner(data); } } class Program { static void Main(string[] args) { Outer p1 = new Outer(1); Outer p2 = p1; Console.WriteLine("p1:{0}, p2:{1}", p1.inner.data, p2.inner.data); p1.inner.data = 2; Console.WriteLine("p1:{0}, p2:{1}", p1.inner.data, p2.inner.data); p2.inner.data = 3; Console.WriteLine("p1:{0}, p2:{1}", p1.inner.data, p2.inner.data); Console.ReadKey(); } } }

    Read the article

  • Resolve bash variable containted in another variable

    - by kogut
    I have code like that: TEXT_TO_FILTER='I would like to replace this $var to proper value' var=variable All I want to get is: TEXT_AFTER_FILTERED="I'd like to replace this variable to proper value" So I did: TEXT_AFTER_FILTERED=`eval echo $TEXT_TO_FILTER` TEXT_AFTER_FILTERED=`eval echo $(eval echo $TEXT_TO_FILTER)` Or even more weirder things, but without any effects. I remember that someday I had similar problem and I did something like that: cat << EOF > tmp.sh echo $TEXT_TO_FILTER EOF chmod +x tmp.sh TEXT_AFTER_FILTERED=`. tmp.sh` But this solution seems to be to much complex. Have any of You heard about easier solution?

    Read the article

  • Bash scripting - Iterating through "variable" variable names for a list of associative arrays

    - by user1550254
    I've got a variable list of associative arrays that I want to iterate through and retrieve their key/value pairs. I iterate through a single associative array by listing all its keys and getting the values, ie. for key in "${!queue1[@]}" do echo "key : $key" echo "value : ${queue1[$key]}" done The tricky part is that the names of the associative arrays are variable variables, e.g. given count = 5, the associative arrays would be named queue1, queue2, queue3, queue4, queue5. I'm trying to replace the sequence above based on a count, but so far every combination of parentheses and eval has not yielded much more then bad substitution errors. e.g below: for count in {1,2,3,4,5} do for key in "${!queue${count}[@]}" do echo "key : $key" echo "value : ${queue${count}[$key]}" done done Help would be very much appreciated!

    Read the article

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