Search Results

Search found 15797 results on 632 pages for 'session variables'.

Page 72/632 | < Previous Page | 68 69 70 71 72 73 74 75 76 77 78 79  | Next Page >

  • iphone not displaying array variables correctly

    - by Rob
    I was reading a tutorial on how to do a UIPicker and found this code: - (IBAction)buttonPressed { NSInteger row = [userPicker selectedRowInComponent:0]; NSString *selected = [userPickerData objectAtIndex:row]; NSString *title = [[NSString alloc] initWithFormat:@"You selected %a", selected]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:@"Thank you for Choosing." delegate:nil cancelButtonTitle:@"You're Welcome" otherButtonTitles:nil]; [alert show]; [alert release]; [title release]; } - (void)viewDidLoad { // [super viewDidLoad]; NSArray *array = [[NSArray alloc] initWithObjects:@"New", @"Frank", @"Bob", @"Thor", nil]; self.userPickerData = array; [array release]; } The UIPicker displays correctly and the variables in the picker also display correctly. When the button is pressed then the alert message does come up but it says, "You selected.." and then it's a bunch of gibberish. Why aren't the array variables being passed correctly?

    Read the article

  • About fork system call and global variables

    - by lurks
    I have this program in C++ that forks two new processes: #include <pthread.h> #include <iostream> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <cstdlib> using namespace std; int shared; void func(){ extern int shared; for (int i=0; i<10;i++) shared++; cout<<"Process "<<getpid()<<", shared " <<shared<<", &shared " <<&shared<<endl; } int main(){ extern int shared; pid_t p1,p2; int status; shared=0; if ((p1=fork())==0) {func();exit(0);}; if ((p2=fork())==0) {func();exit(0);}; for(int i=0;i<10;i++) shared++; waitpid(p1,&status,0); waitpid(p2,&status,0);; cout<<"shared variable is: "<<shared<<endl; cout<<"Process "<<getpid()<<", shared " <<shared<<", &shared " <<&shared<<endl; } The two forked processes make an increment on the shared variables and the parent process does the same. As the variable belongs to the data segment of each process, the final value is 10 because the increment is independent. However, the memory address of the shared variables is the same, you can try compiling and watching the output of the program. How can that be explained ? I cannot understand that, I thought I knew how the fork() works, but this seems very odd.. I need an explanation on why the address is the same, although they are separate variables.

    Read the article

  • Is there a LocalAppData Environement Variable in Windows 2003?

    - by brendan
    Per this question I need to call via code the following paths: Windows 2003: C:\Documents and Settings\Administrator\Local Settings\Application Data\Google\Chrome\Application\chrome.exe Windows 2008: C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chrome.exe Ideally I could use the environment variable %localdata%\Google\Chrome\Application\chrome.exe but this does not work for me in Windows 2003. Should it? How can I refer to this path in both systems using environment variables?

    Read the article

  • C++ this as thread parameter, variables unavailable

    - by brecht
    I have three classes: class Rtss_Generator { int mv_transfersize; } class Rtss_GenSine : Rtss_Generator class Rtss_GenSineRpm : Rtss_GenSine Rtss_GenSine creates a thread in his constructer, it is started immediatly and the threadfunction is off-course declared static, waiting for an event to start calculating. the problem: all the variables that are accessed through the gen-pointer are 0, but it does not fail. Also, this-address in the constructer and the gen-pointer-address in the thread are the same, so the pointer is ok. this code is created and compile in visual studio 6.0 service pack 2003 ORIGINAL CODE no thread Rtss_GenSine::getNextData() { //[CALCULATION] //mv_transferSize is accessible and has ALWAYS value 1600 which is ok } NEW CODE Rtss_GenSine::Rtss_GenSine() { createThread(NULL, threadFunction, (LPVOID) this,0,0); } Rtss_GenSine::getNextData() { SetEvent(startCalculating); WaitForSingleObject(stoppedCalculaing, INFINITE); } DWORD Rtss_GenSine::threadFunction(LPVOID pParam) { Rtss_GenSine* gen = (Rtss_GenSine*) pParam; while(runThread) { WaitForSingleObject(startCalculating, INFINITE); ResetEvent(startCalculating) //[CALCULATION] //gen->mv_transferSize ---> it does not fail, but is always zero //all variables accessed via the gen-pointer are 0 setEvent(stoppedCalculaing) } }

    Read the article

  • Only variables can be passed by reference

    - by zaf
    I had the bright idea of using a custom error handler which led me down a rabbit hole. Following code gives (with and without custom error handler): Fatal error: Only variables can be passed by reference function foo(){ $b=array_pop(array("a","b","c")); return $b; } print_r(foo()); Following code gives (only with a custom error handler): (2048) Only variables should be passed by reference function foo(){ $a=explode( '/' , 'a/b/c'); $c=array_pop(array_slice($a,-2,1)); return $c; } print_r(foo()); The second one worries me since I have a lot of 'compact' code. So, I either ditch the bright idea of using a custom error handler (to improve my logging module) or expand all my code. Anyone with better ideas? Also, WTF?

    Read the article

  • SED, using variables and in with an array

    - by S1syphus
    What I am trying to do is run the sed on multiple files in the directory Server_Upload, using variables: AB${count} Corresponds, to some variables I made that look like: echo " AB1 = 2010-10-09Three " echo " AB2 = 2009-3-09Foo " echo " AB3 = Bar " And these correspond to each line which contains a word in master.ta, that needs changing in all the text files in Server_Upload. If you get what I mean... great, I have tried to explain it the best I can, but if you are still miffed I'll give it another go as I found it really hard to convey what I mean. cd Server_Upload for fl in *.UP; do mv $fl $fl.old done count=1 saveIFS="$IFS" IFS=$'\n' array=($(<master.ta)) IFS="$saveIFS" for i in "${array[@]}" do sed "s/$i/AB${count}/g" $fl.old > $fl (( count++ )) done It runs, doesn't give me any errors, but it doesn't do what I want, so any ideas?

    Read the article

  • setting actionscript 3 superclass variables

    - by jedierikb
    In AS3, if I have a class such: public class dude { //default value for a dude protected var _strength:Number = 1; public function dude( ):void { super( ); //todo... calculate abilities of a dude based on his strength. } } and a subclass public class superDude extends dude { public function superDude( ):void { _strength = 100; super( ); trace( "strength of superDude: " + _strength ); } } This will trace strength of superDude is 1. I expected the variable I set in the subclass (prior to calling the superclass constructor) to remain. Is there a way to assign class variables in subclass constructors which are not over-written by the superclass construtor? Or should I pass them up as constructor variables?

    Read the article

  • Including C header file with lots of global variables

    - by Costi
    I have an include file with 100+ global variables. It's being used in a library, but some programs that I'm linking the lib to also need to access the globals. The way it was built: // In one library .c file #define Extern // In the programs that use the globals #define Extern extern // In the .h file Extern int a,b,c; I had a hard time understanding why the original programmer did that so I removed that define Extern stuff. Now I think I understand the thing about TU with the help of stackoverflow: 1, 2, 3. Now I understand that I should define the global variables in one .c file in the library and use extern in the .h file. The problem is that I don't want to duplicate code. Should I go back to that #define Extern voodoo?

    Read the article

  • stting environment variables in powershell by calling python script that prints $env:myVar=myvalue

    - by leeg
    I have some legacy python scripts that manage my shell environment for all the programs and plugins I am running on Linux (bash) and windows (cmd.exe). I want to port this to powershell. How do I set environment variables in powershell by calling python script that prints $env:myVar=myvalue and causes my environment variable to persist in the powershell. In Bash I can use a bash function to call my python script which prints export var=value to stdout and the function will set the environment variables in my shell. This will also work in windows cmd shell by calling a .bat file. I cannot figure out how to do this in powershell. I think it should be something like this: setvar.ps1: function SETVAR {c:\python26\python.exe varconfig.py } varconfig.py: import sys print >> sys.stdout, '$env:myVar=foo'

    Read the article

  • Why won't my Windows 8 Command line update its path

    - by mawcsco
    I needed to add a new entry to my PATH variable. This is a common activity for me in my job, but I've recently started using Windows 8. I assumed the process would be similar to Windows 7, Vista, XP... Here's my sequence of events: Open System properties (Start- [type "Control Panel"] - Control Panel\System and Security\System - Advanced system settings - Environment Variables) Add the new path to beginning of my USER PATH variable (C:\dev\Java\apache-ant-1.8.4\bin;) Opened a command prompt (Start - [type "command prompt" enter] - [type "path" enter] My new path entry is not available (see attached image and vide). I Duplicated the exact same process on a Windows 7 machine and it worked. EDIT Windows 8 Environment Variables and Command Prompt video EDIT This is definitely not the behavior of Windows 7. Watch this video to see the behavior I expect working in Windows 7. http://youtu.be/95JXY5X0fII EDIT 5/31/2013 So, after much frustration, I wrote a small C# app to test the WM_SETTINGCHANGE event. This code receives the event in both Windows 7 and Windows 8. However, in Windows 8 on my system, I do not get the correct path; but, I do in Windows 7. This could not be reproduced in other Windows 8 systems. Here is the C# code. using System; using Microsoft.Win32; public sealed class App { static void Main() { SystemEvents.UserPreferenceChanging += new UserPreferenceChangingEventHandler(OnUserPreferenceChanging); Console.WriteLine("Waiting for system events."); Console.WriteLine("Press <Enter> to exit."); Console.ReadLine(); } static void OnUserPreferenceChanging(object sender, UserPreferenceChangingEventArgs e) { Console.WriteLine("The user preference is changing. Category={0}", e.Category); Console.WriteLine("path={0}", System.Environment.GetEnvironmentVariable("PATH")); } } OnUserPreferenceChanging is equivalent to WM_SETTINGCHANGE C# program running in Windows 7 (you can see the event come through and it picks up the correct path). C# program running in Windows 8 (you can see the event come through, but the wrong path). There is something about my environment that is precipitating this problem. However, is this a Windows 8 bug?

    Read the article

  • Access inner function variables in Javascript

    - by Elazar Leibovich
    In many frameworks, internal function variables are used as private variables, for example Raphael = (function(){ var private = function(a,b) {return a+b;}; var public = function(a) {return private(a,a);} var object = {mult2:public}; return object; })(); here, we cannot access from the global namespace the variable named private, as it is an inner variable of the anonymous function in the first line. Sometimes this function is contains a big Javascript framework, so that it wouldn't pollute the global namespace. I need to unit tests some object Raphael uses internally (in the above example, I wish to run unit tests on the object private). How can I test them?

    Read the article

  • Values of Variables Matrix NumPy

    - by Max Mines
    I'm working on a program that determines if lines intersect. I'm using matrices to do this. I understand all the math concepts, but I'm new to Python and NumPy. I want to add my slope variables and yint variables to a new matrix. They are all floats. I can't seem to figure out the correct format for entering them. Here's an example: import numpy as np x = 2 y = 5 w = 9 z = 12 I understand that if I were to just be entering the raw numbers, it would look something like this: matr = np.matrix('2 5; 9 12') My goal, though, is to enter the variable names instead of the ints.

    Read the article

  • magento success page variables

    - by user1799790
    I am trying to capture some magento success page variables to pass to our advertising company. So far I have got this but the variables are not outputting anything: <?php $items = $order->getItemsCollection(); foreach ($items as $item) { $price="'".$item->getPrice()."', "; $qty="'".$item->getQty()."', "; $sku="'".$item->getSku()."', "; } ?> The data needs to be in the format: 'price1', 'price2', 'price3' 'qty1', 'qty2', 'qty3' 'sku1', 'sku2', 'sku3'

    Read the article

  • Passing javascript form variables into jQuery function not working

    - by Chase
    I am trying to pass some JavaScript variables that I have assigned to form variables into a query string used by a jQuery plug in called fancybox. If I hard code in the string that I want lightbox works great, however I need it to pass some form values in there to make it work as desire. <script type="text/javascript"> $(document).ready(function(){ var item = document.itemFinder.item; var zip = document.itemFinder.zip; var radius = document.itemFinder.radius; var dataString = "item=" + item + "&zip=" + zip + "&radius=" + radius; $("#various3").fancybox({ ajax : { type : "POST", data : dataString}, 'scrolling' : 'auto', 'overlayOpacity' : '0' } ); }); </script> What am I doing wrong?

    Read the article

  • supervisord environment variables setting up application

    - by user1434844
    I'm running an application from supervisord and I have to set up an environment for it. There are about 30 environment variables that need to be set. I've tried putting all on one big environment= line and that doesn't seem to work. I've also tried multiple enviroment= lines, and that doesn't seem to work either. I've also tried both with and without ' around the env value. What's the best way to set up my environment such that it remains intact under supervisord control? Should I be calling my actual program (tornado, fwiw) from a shell script with the environment preloaded there? Ideally, I'd like to put all of the enviroment variables into an include file and load them with supervisor, but I'm open to doing it another way.

    Read the article

  • More elegant way to parse inline variables in strings

    - by Tom
    Currently I have this: function parse_string($string, $variables){ extract($variables); return eval('return "'. addcslashes($string, '"') .'";'); } So I can input this string: 'Hi {$name}, my name is {$own_name}' Together with this array: array('name' => 'John', 'own_name' => 'Tom') And get this back: 'Hi John, my name is Tom'   I've never liked this eval() approach but it works and it's fast (faster than regex at least). Question: Is there a more elegant way to do this (faster than using regex) in PHP5?

    Read the article

  • Transient variables are not captured properly on form submission

    - by Kalpana
    My User entity class have several member variables (e.g. String firstName) which are persisted and some transient variables (e.g. transient boolean selected) which are not. I have used the transient variable to capture a checkbox selection, but invariably the value never gets set and procesed properly until I set another bean value along with it. i.e. If User has firstName (mapped to a text field) and selected (mapped to a checkbox) If I just selected the value doesn't seem to be set on an update If I had selected the checkbox and the firstName field, the "selected" value is captured properly Can anyone tell me why this is happening?

    Read the article

< Previous Page | 68 69 70 71 72 73 74 75 76 77 78 79  | Next Page >