Search Results

Search found 3947 results on 158 pages for 'passing'.

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

  • Is passing NULL param exactly the same as passing no param

    - by park
    I'm working with a function whose signature looks like this afunc(string $p1, mixed $p2, array $p3 [, int $p4 = SOM_CONST [, string $p5 ]] ) In some cases I don't have data for the last parameter $p5 to pass, but for the sake of consistency I still want to pass something like NULL. So my question, does PHP treat passing a NULL exactly the same as not passing anything? somefunc($p1, $p2, $p3, $p4 = SOM_CONST); somefunc($p1, $p2, $p3, $p4 = SOM_CONST, NULL);

    Read the article

  • UI message passing programming paradigm

    - by Ronald Wildenberg
    I recently (about two months ago) read an article that explained some user interface paradigm that I can't remember the name of and I also can't find the article anymore. The paradigm allows for decoupling the user interface and backend through message passing (via some queueing implementation). So each user action results in a message being pased to the backend. The user interface is then updated to inform the user that his request is being processed. The assumption is that a user interface is stale by definition. When you read data from some store into memory, it is stale because another transaction may be updating the same data already. If you assume this, it makes no sense to try to represent the 'current' database state in the user interface (so the delay introduced by passing messages to a backend doesn't matter). If I remember correctly, the article also mentioned a read-optimized data store for rendering the user interface. The article assumed a high-traffic web application. A primary reason for using a message queue communicating with the backend is performance: returning control to the user as soon as possible. Updating backend stores is handled by another process and eventually these changes also become visible to the user. I hope I have explained accurately enough what I'm looking for. If someone can provide some pointers to what I'm looking for, thanks very much in advance.

    Read the article

  • Passing data from one database to another database table (Access) (C#)

    - by SAMIR BHOGAYTA
    string conString = "Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source=Backup.mdb;Jet OLEDB:Database Password=12345"; OleDbConnection dbconn = new OleDbConnection(); OleDbDataAdapter dAdapter = new OleDbDataAdapter(); OleDbCommand dbcommand = new OleDbCommand(); try { if (dbconn.State == ConnectionState.Closed) dbconn.Open(); string selQuery = "INSERT INTO [Master] SELECT * FROM [MS Access;DATABASE="+ "\\Data.mdb" + ";].[Master]"; dbcommand.CommandText = selQuery; dbcommand.CommandType = CommandType.Text; dbcommand.Connection = dbconn; int result = dbcommand.ExecuteNonQuery(); } catch(Exception ex) {}

    Read the article

  • Passing array by ref.

    - by atch
    Ref. to my last post and sellibitze's comment to that post on passing array by ref rather than by value, why is it that when I'm passing array by value compiler can deduce arguments but it won't do it if I pass it by value? @Paul So just to make it clear when I'm declaring fnc: void f(int a[]);//I'm passing a pointer but when I'm declaring: void f(int &a[]);//I'm passing a ref? Do I understand this correctly now?

    Read the article

  • Passing big multi-dimensional array to function in C

    - by kirbuchi
    Hi, I'm having trouble passing a big array to a function in C. I declare: int image[height][width][3]={}; where height and width can be as big as 1500. And when I call: foo((void *)image,height,width); which is declared as follows: int *foo(const int *inputImage, int h, int w); I get segmentation fault error. What's strange is that if my values are: height=1200; width=290; theres no problem, but when they're: height=1200; width=291; i get the mentioned error. At 4 bytes per integer with both height and width of 1500 (absolute worst case) the array size would be of 27MB which imo isn't that big and shouldn't really matter because I'm only passing a pointer to the first element of the array. Any advice?

    Read the article

  • Passing a DefaultHttpClient between activites

    - by searchMaker
    Hi all, I am trying to maintain my session variables that I get back in a cookie from my website in my DefaultHttpClient by passing the client between activities. Simply put how can I pass this object between activities to maintain my session variables? Bundle.put... doesn't seem to support this object. If it does how does it work with DefaultHttpClient? Thanks in advance to anyone who can help.

    Read the article

  • what functions are called when passing value to function

    - by Tim
    In C++, if an object of a class is passed as a parameter into a function, the copy constructor of the class will be called. I was wondering if the object is of nonclass type, what function will be called? Similarly in C, what function is called when passing values or address of variables into a function? Thanks and regards!

    Read the article

  • Passing data between asp.net pages

    - by user204588
    Hello, I'm wondering the opinion of what is the best way to pass a lot of values between pages. I was thinking of either saving the values to a database, using context.Items[], or Session[]. I'm not sure about what is the best method. I'm passing probably around 40 variables.

    Read the article

  • C# out parameter value passing..

    - by Pandiya Chendur
    I am using contactsreader.dll to import my gmail contacts... One of my method has out parameter... I am doing this, Gmail gm = new Gmail(); DataTable dt = new DataTable(); string strerr; gm.GetContacts("[email protected]", "******", true, dt,strerr); // It gives invalid arguments error.. and my gmail class has, public void GetContacts(string strUserName, string strPassword,out bool boolIsOK, out DataTable dtContatct, out string strError); Am i passing the correct values for out parameters...

    Read the article

  • Ruby - Call method passing values of array as each parameter

    - by Markus Orreilly
    I'm currently stuck on this problem. I've hooked into the method_missing function in a class I've made. When a function is called that doesn't exist, I want to call another function I know exists, passing the args array as all of the parameters to the second function. Does anyone know a way to do this? For example, I'd like to do something like this: class Blah def valid_method(p1, p2, p3, opt=false) puts "p1: #{p1}, p2: #{p2}, p3: #{p3}, opt: #{opt.inspect}" end def method_missing(methodname, *args) if methodname.to_s =~ /_with_opt$/ real_method = methodname.to_s.gsub(/_with_opt$/, '') send(real_method, args) # <-- this is the problem end end end b = Blah.new b.valid_method(1,2,3) # output: p1: 1, p2: 2, p3: 3, opt: false b.valid_method_with_opt(2,3,4) # output: p1: 2, p2: 3, p3: 4, opt: true (Oh, and btw, the above example doesn't work for me)

    Read the article

  • $.(ajax) wrapper for Jquery - passing parameters to delegates

    - by gnomixa
    I use $.(ajax) function extensively in my app to call ASP.net web services. I would like to write a wrapper in order to centralize all the ajax calls. I found few simple solutions, but none address an issue of passing parameters to delegates, for example, if i have: $.ajax({ type: "POST", url: "http://localhost/TemplateWebService/TemplateWebService/Service.asmx/GetFoobar", data: jsonText, contentType: "application/json; charset=utf-8", dataType: "json", success: function(response) { var results = (typeof response.d) == 'string' ? eval('(' + response.d + ')') : response.d; OnSuccess(results, someOtherParam1, someOtherParam2); }, error: function(xhr, status, error) { OnError(); } }); The wrapper to this call would have to have the way to pass someOtherParam1, someOtherParam2 to the OnSuccess delegate...Aside from packing the variables into a generic array, I can't think of other solutions. How did you guys address this issue?

    Read the article

  • PHP: passing GET between multiple pages

    - by aterimperator
    I'm building a set of pages where I have a number of GET variables and it is often valuable to keep passing it along to the next page. This leads to ugly code where I have to have "if this $_GET variable is set, dynamically add it to this hyperlink". This is, in many senses, not a problem; but I had the thought "there must be a better way to do this", I mean after all basically all I want is to take the '?' and everything after it and append it to the links on that page, it would seem this should be rather simple (or at least possible to do in a for loop). I tried google searching but couldn't find anything, so I figured I'd see if any of you happen to know. Why not use SESSION? Because these pages need to be capable of being bookmarked. Thank you.

    Read the article

  • Passing expression as a parameter in Call by reference

    - by darkie15
    All, When we are passing an expression as a parameter, how does the evaluation occur? Here is a small example. This is just a pseudocode kind of example: f (x,y) { y = y+1; x = x+y; } main() { a = 2; b = 2; f(a+b, a) print a; } When accessing variable x in f, does it access the address of the temp variable which contains the result of a+b or will it access the individual addresses of a and b and then evaluate the value of a+b Please help. Regards, darkie15

    Read the article

  • Passing Variable Length Arrays to a function

    - by David Bella
    I have a variable length array that I am trying to pass into a function. The function will shift the first value off and return it, and move the remaining values over to fill in the missing spot, putting, let's say, a -1 in the newly opened spot. I have no problem passing an array declared like so: int framelist[128]; shift(framelist); However, I would like to be able to use a VLA declared in this manner: int *framelist; framelist = malloc(size * sizeof(int)); shift(framelist); I can populate the arrays the same way outside the function call without issue, but as soon as I pass them into the shift function, the one declared in the first case works fine, but the one in the second case immediately gives a segmentation fault. Here is the code for the queue function, which doesn't do anything except try to grab the value from the first part of the array... int shift(int array[]) { int value = array[0]; return value; } Any ideas why it won't accept the VLA? I'm still new to C, so if I am doing something fundamentally wrong, let me know.

    Read the article

  • R: Pass by reference

    - by Pierre
    Can you pass by reference with "R" ? for example, in the following code: setClass("MyClass", representation( name="character" )) instance1 <-new("MyClass",name="Hello1") instance2 <-new("MyClass",name="Hello2") array = c(instance1,instance2) instance1 array instance1@name="World!" instance1 array the output is > instance1 An object of class “MyClass” Slot "name": [1] "World!" > array [[1]] An object of class “MyClass” Slot "name": [1] "Hello1" [[2]] An object of class “MyClass” Slot "name": [1] "Hello2" but I wish it was > instance1 An object of class “MyClass” Slot "name": [1] "World!" > array [[1]] An object of class “MyClass” Slot "name": [1] "World!" [[2]] An object of class “MyClass” Slot "name": [1] "Hello2" is it possible ? Thanks Pierre

    Read the article

  • How to pass values between two Custom UITableViewCells in iphone

    - by Mithun
    I have two customized cells in an iphone UITableViewController and would like to capture the data in one cell into another..... I am currently unable to post images and pls assume the following points. There are two custom UITableViewcells 1) Notes Textfield in one customcell 2) Submit button in another text field. Now i want to pass data typed in the notes textfield to be available when I click the Submit button.... Is this possible? Please help....:(

    Read the article

  • Passing variables, creating instances, self, The mechanics and usage of classes: need explenation

    - by Baf
    I've been sitting over this the whole day and Im a little tired already so please excuse me being brief. Im new to python. I just rewrrote a working program, into a bunch of functions in a class and everzthings messed up. I dont know if its me but Im very surprised i couldn t find a beginners tutorial on how to handle classes on the web so I have a few questions. First of all, in the init section of the class i have declared a bunch of variables with self.variable=something. Is it correct that i should be able to access/modify these variables in every function of the class by using self.variable in that function? In other words by declaring self.variable i have made these variables, global variables in the scope of the class right? If not how do i handle self. ? Secondly how do i correctly pass arguments to the class? some example code would be cool. thirdly how do i call a function of the class outside of the class scope? some example code would be cool. fouthly how do I create an Instance of the class INITIALCLASS in another class OTHERCLASS, passing variables from OTHERCLASS to INITIALCLASS? some example code would be cool. I Want to call a function from OTHERCLASS with arguments from INITIALCLASS. What Ive done so far is. class OTHERCLASS(): def __init__(self,variable1,variable2,variable3): self.variable1=variable1 self.variable2=variable2 self.variable3=variable3 def someotherfunction(self): something=somecode(using self.variable3) self.variable2.append(something) print self.variable2 def somemorefunctions(self): self.variable2.append(variable1) class INITIALCLASS(): def __init__(self): self.variable1=value1 self.variable2=[] self.variable3='' self.DoIt=OTHERCLASS(variable1,variable2,variable3) def somefunction(self): variable3=Somecode #tried this self.DoIt.someotherfunctions() #and this DoIt.someotherfunctions() I clearly havent understood how to pass variables to classes or how to handle self, when to use it and when not, I probably also havent understood how to properly create an isntance of a class. In general i havent udnerstood the mechanics of classes So please help me and explain it to me like i have no Idea( which i dont it seems). Or point me to a thorough video, or readable tutorial. All i find on the web is super simple examples, that didnt help me much. Or just very short definitions of classes and class methods instances etc. I can send you my original code if you guys want, but its quite long. Thanks for the Help Much appreciated!

    Read the article

  • Passing char * into fopen with C.

    - by Rhys
    Hey there, I'm writing a program that passes data from a file into an array, but I'm having trouble with fopen (). It seems to work fine when I hardcode the file path into the parameters (eg fopen ("data/1.dat", "r");) but when I pass it as a pointer, it returns NULL. Note that line 142 will print "data/1.dat" if entered from command line so parse_args () appears to be working. 132 int 133 main(int argc, char **argv) 134 { 135 FILE *in_file; 136 int *nextItem = (int *) malloc (sizeof (int)); 137 set_t *dictionary; 138 139 /* Parse Arguments */ 140 clo_t *iopts = parse_args(argc, argv); 141 142 printf ("INPUT FILE: %s.\n", iopts->input_file); /* This prints correct path */ 143 /* Initialise dictionary */ 144 dictionary = set_create (SET_INITAL_SIZE); 145 146 /* Use fscanf to read all data values into new set_t */ 147 if ((in_file = fopen (iopts->input_file, "r")) == NULL) 148 { 149 printf ("File not found...\n"); 150 return 0; 151 } Thanks! Rhys

    Read the article

  • Passing Variables between views / view controllers

    - by Dan
    Hi I'm new to ObjectiveC / IPhoneSDK and I'm informally trying to study it on my own. What I'm basically trying to do is from one view there are 12 zodiac signs. When a user clicks one, it proceeds to the second view (with animation) and loads the name of the zodiac sign it clicked in a UILabel, that's it. Here are my codes: Lovescopes = 1st page Horoscopes = 2nd page Lovescopes4AppDelegate.h #import <UIKit/UIKit.h> #import "HoroscopesViewController.h" #import "Lovescopes4AppDelegate.h" @class Lovescopes4ViewController; @interface Lovescopes4AppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; Lovescopes4ViewController *viewController; HoroscopesViewController *horoscopesViewController; } -(void)loadHoroscope; -(void)loadMainPage; @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet Lovescopes4ViewController *viewController; @property (nonatomic, retain) HoroscopesViewController *horoscopesViewController; @end Lovescopes4AppDelegate.m #import "Lovescopes4AppDelegate.h" #import "Lovescopes4ViewController.h" @implementation Lovescopes4AppDelegate @synthesize window; @synthesize viewController; @synthesize horoscopesViewController; -(void)loadHoroscope { HoroscopesViewController *aHoroscopeViewController = [[HoroscopesViewController alloc] initWithNibName:@"HoroscopesViewController" bundle:nil]; [self setHoroscopesViewController:aHoroscopeViewController]; [aHoroscopeViewController release]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:window cache:YES]; [viewController.view removeFromSuperview]; [self.window addSubview:[horoscopesViewController view]]; [UIView commitAnimations]; } -(void)loadMainPage { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:window cache:NO]; [horoscopesViewController.view removeFromSuperview]; [self.window addSubview:[viewController view]]; [UIView commitAnimations]; [horoscopesViewController release]; horoscopesViewController = nil; } - (void)applicationDidFinishLaunching:(UIApplication *)application { // Override point for customization after app launch [window addSubview:viewController.view]; [window makeKeyAndVisible]; } - (void)dealloc { [viewController release]; [window release]; [super dealloc]; } @end Lovescopes4ViewController.h #import <UIKit/UIKit.h> #import "HoroscopesViewController.h" @interface Lovescopes4ViewController : UIViewController { HoroscopesViewController *hvc; } -(IBAction)loadAries; @property (nonatomic, retain) HoroscopesViewController *hvc; @end Lovescope4ViewController.m #import "Lovescopes4ViewController.h" #import "Lovescopes4AppDelegate.h" @implementation Lovescopes4ViewController @synthesize hvc; -(IBAction)loadAries { NSString *selected =@"Aries"; [hvc loadZodiac:selected]; Lovescopes4AppDelegate *mainDelegate = (Lovescopes4AppDelegate *) [[UIApplication sharedApplication] delegate]; [mainDelegate loadHoroscope]; } HoroscopesViewController.h #import <UIKit/UIKit.h> @interface HoroscopesViewController : UIViewController { IBOutlet UILabel *zodiacLabel; } -(void)loadZodiac:(id)zodiacSign; -(IBAction)back; @property (nonatomic, retain) IBOutlet UILabel *zodiacLabel; @end HoroscopesViewController.m #import "HoroscopesViewController.h" #import "Lovescopes4AppDelegate.h" @implementation HoroscopesViewController @synthesize zodiacLabel; /* // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { // Custom initialization } return self; } */ /* // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; } */ /* // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); } */ -(void)loadZodiac:(id)zodiacSign { zodiacLabel.text = [NSString stringWithFormat: @"%@", zodiacSign]; } -(IBAction)back { Lovescopes4AppDelegate *mainDelegate = (Lovescopes4AppDelegate *) [[UIApplication sharedApplication] delegate]; [mainDelegate loadMainPage]; }

    Read the article

  • passing a variable to a ajax request Jquery

    - by user304735
    Hello, I am trying to pass a variable to an ajax request via jquery. I have a triggered event that defines the variable. I want to do this so that I can have one ajax request handle multiple urls. I have alerted the url and it come back fine, but when I plug it into the URL slot of a $.ajax request my targeted content does not load. Here is my code. $(document).ready(function(){ $('a').live('click', function(){ var link = $(this).attr("href"); $.ajax({ url: link, success: function(html){ $('#load').html(html) } }); }); }); this has been a real headache and I feel I am just misusing something. Please help.

    Read the article

  • CakePHP passing parameters to action

    - by iancocco
    Hi im kinda new in cakephp and having a lot of trouble adjusting.. Here's my biggest problem .. Im trying to pass a parameter to an action, it does load, but when my script goes from the controller to the view, and goes back to the controller again, its gone. CONTROLLER CODE function add($mac = 0) { if(isset($this->params['form']['medico'])) { $temp= $this->Person->find('first', array('conditions' => array('smartphones_MAC' => $mac))); $id= $temp['Person']['id']; $this->Union->set('events_id', $id+1); $this->Union->set('people_id', $id); $this->Union->save(); } VIEW CODE (This is a menu, i only have one button right now) <fieldset> <legend>SELECCIONE SU ALERTA</legend> <?php echo $form->create('Event'); echo $form->submit('EMERGENCIA MEDICA',array('name'=>'medico')); echo $form->end(); ?> </fieldset>

    Read the article

  • Passing list and dictionary type parameter with Python

    - by prosseek
    When I run this code def func(x, y, *w, **z): print x print y if w: print w if z: print z else: print "None" func(10,20, 1,2,3,{'k':'a'}) I get the result as follows. 10 20 (1, 2, 3, {'k': 'a'}) None But, I expected as follows, I mean the list parameters (1,2,3) matching *w, and dictionary matching **z. 10 20 (1,2,3) {'k':'a'} Q : What went wrong? How can I pass the list and dictionary as parameters? Added func(10,20, 10,20,30, k='a') seems to be working

    Read the article

  • passing array of structs from c# to regular dll

    - by buzz
    Hi there I have a regular dll with the followign fucntion exported. extern "C" __declspec(dllexport) int FindNearestStuff(double _latitude, double _longitude , LocationStruct * locations[]) LocationStruct is very simple struct LocationStruct { long positionIndex; long item; }; I'm tryign to call it from c# using [DllImport("myclever.dll", CharSet = CharSet.None)] private static extern int FindNearestStuff(double _latitude, double _longitude, ref LocationStruct [] locations); Its all cool and funky and i can step into the dll function from the debugger. Inside the dll the LocationStruct array is populated correctly and all is very good. the problem i have is when it returns back from the dll, the LocationStruct array is not coming back with the data - just empty values... what am i missing? cheers Buzz

    Read the article

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