Search Results

Search found 7418 results on 297 pages for 'argument passing'.

Page 23/297 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • Passing data from a View to a controller in ASP.Net MVC

    - by kingrichard2005
    Hello, I have a dictionary I'm passing to a View. I want to be able to pass the values of that dictionary back to a Controller action from this same View. Is there anyway this can be accomplished without using a form? The situation is that I need to be able to pass these back to a controller action that is called when a user clicks an ActionLink from the View, and in my experience an ActionLink cannot be used to submit a values of a form, i.e. I've only been able to submit values of a form using the form's submit button. Unless there's a way to use an ActionLink to submit values in a form.

    Read the article

  • Multi-argument decorators in 2.6

    - by wheaties
    Generally don't do OO-programming in Python. This project requires it and am running into a bit of trouble. Here's my scratch code for attempting to figure out where it went wrong: class trial(object): def output( func, x ): def ya( self, y ): return func( self, x ) + y return ya def f1( func ): return output( func, 1 ) @f1 def sum1( self, x ): return x which doesn't compile. I've attempted to add the @staticmethod tag to the "output" and "f1" functions but to no avail. Normally I'd do this def output( func, x ): def ya( y ): return func( x ) + y return ya def f1( func ): return output( func, 1 ) @f1 def sum1( x ): return x which does work. So how do I get this going in a class?

    Read the article

  • passing structure directly to function

    - by ra170
    I have a struct that I initialize like this: typedef struct { word w; long v; } MyStruct; MyStruct sx = {0,0}; Update(sx); Now, it seems such a waste to first declare it and then to pass it. I know that in C#, there's a way to do everything in one line. Is there any possiblity of passing it in a more clever (read: cleaner) way to my update function?

    Read the article

  • about the post_save signal and created argument

    - by panchicore
    the docs says: post_save django.db.models.signals.post_save created A boolean; True if a -new- record was create. and I have this: from django.db.models.signals import post_save def handle_new_user(sender, instance, created, **kwargs): print "--------> save() "+str(created) post_save.connect(handle_new_user, sender=User) when I do in shell: u = User(username="cat") u.save() >>> --------> save() True u.username = "dog" u.save() >>> --------> save() True I expect a -------- save() False when I save() the second time because is an update? not?

    Read the article

  • Passing arguments to anonymous inner classes

    - by synic
    I'm trying to make an API library for our web services, and I'm wondering if it's possible to do something like this: abstract class UserRequest(val userId: Int) { def success(message: String) def error(error: ApiError) } api.invokeRequest(new UserRequest(121) { override def success(message: String) = { // handle success } override def error(error: ApiError) = { // handle the error } } I'm talking about passing parameters to the anonymous inner class, and also overriding the two methods. I'm extremely new to Scala, and I realize my syntax might be completely wrong. I'm just trying to come up with a good design for this library before I start coding it. I'm willing to take suggestions for this, if I'm doing it the completely wrong way, or if there's a better way. The idea is that the API will take some sort of request object, use it to make a request in a thread via http, and when the response has been made, somehow signal back to the caller if the request was a success or an error. The request/error functions have to be executed on the main thread.

    Read the article

  • Template function as a template argument

    - by Kos
    I've just got confused how to implement something in a generic way in C++. It's a bit convoluted, so let me explain step by step. Consider such code: void a(int) { // do something } void b(int) { // something else } void function1() { a(123); a(456); } void function2() { b(123); b(456); } void test() { function1(); function2(); } It's easily noticable that function1 and function2 do the same, with the only different part being the internal function. Therefore, I want to make function generic to avoid code redundancy. I can do it using function pointers or templates. Let me choose the latter for now. My thinking is that it's better since the compiler will surely be able to inline the functions - am I correct? Can compilers still inline the calls if they are made via function pointers? This is a side-question. OK, back to the original point... A solution with templates: void a(int) { // do something } void b(int) { // something else } template<void (*param)(int) > void function() { param(123); param(456); } void test() { function<a>(); function<b>(); } All OK. But I'm running into a problem: Can I still do that if a and b are generics themselves? template<typename T> void a(T t) { // do something } template<typename T> void b(T t) { // something else } template< ...param... > // ??? void function() { param<SomeType>(someobj); param<AnotherType>(someotherobj); } void test() { function<a>(); function<b>(); } I know that a template parameter can be one of: a type, a template type, a value of a type. None of those seems to cover my situation. My main question is hence: How do I solve that, i.e. define function() in the last example? (Yes, function pointers seem to be a workaround in this exact case - provided they can also be inlined - but I'm looking for a general solution for this class of problems).

    Read the article

  • How do I modify the -encoding argument to javac in the Android Ant build system

    - by Paul Butcher
    Apologies if this is a stupid question - I'm an Android and Ant newbie. I have utf8 encoded source files that I need to compile with the Android Ant build system. By default, the encoding is set to ascii. I'd be very grateful for a pointer to whatever I need to do to let the build system know that my files are utf8. Incidentally, it works fine if I build in Eclipse, but I need to build from the command line. Thanks!

    Read the article

  • Passing HttpFileCollectionBase to the Business Layer - Bad?

    - by Terry_Brown
    hopefully there's an easy solution to this one. I have my MVC2 project which allows uploads of files on certain forms. I'm trying to keep my controllers lean, and handle the processing within the business layer of this sort of thing. That said, HttpFileCollectionBase is obviously in the System.Web assembly. Ideally I want to call to something like: UserService.SaveEvidenceFiles(MyUser user, HttpFileCollectionBase files); or something similar and have my business layer handle the logic of how and where these things are saved. But, it feels a little icky to have my models layer with a reference to System.Web in terms of separation of concerns etc. So, we have (that I'm aware of) a few options: the web project handling this, and my controllers getting fatter mapping the HttpFileCollectionBase to something my business layer likes passing the collection through, and accepting that I reference System.Web from my business project Would love some feedback here on best practice approaches to this sort of thing - even if not specifically within the context of the above.

    Read the article

  • symbols in command line argument.. python, bash

    - by Idlecool
    Hi, I am writing a python script on Linux for twitter post using API, Is it possible to pass symbols like "(" ")" etc in clear text without apostrophes.... % ./twitterupdate this is me #works fine % ./twitterupdate this is bad :(( #this leaves a error on bash. Is the only alternative is to enclose the text into -- "" ?? like.. % ./twitterupdate "this is bad :((" #this will reduce the ease of use for the script Is there any workaround?

    Read the article

  • SWIG interface to receive an opaque struct reference in Java through function argument

    - by Beeo
    I am trying to use SWIG in order to use the Spotify API (libspotify) for Android: https://developer.spotify.com/technologies/libspotify/ I am having trouble defining the SWIG interface file to be able to successfully call the following native C function: sp_error sp_session_create(const sp_session_config * config, sp_session ** sess); Which in C would be called like this: //config struct defined previously sp_session *sess; sp_session_create(&config, &sess); But in Java I would need to call it like this: //config object defined previously sp_session javaSess = new sp_session(); sp_session_create(config, javaSess); sp_session is an opaque struct and is only defined in libspotify's API.h file as: typedef struct sp_session sp_session; I'm expecting the libspotify library to create it and give me a reference to it. The only thing I need that reference for then is to pass to other functions in the API. I believe the answer lies within the SWIG interface and typemaps, but I have been unsuccessful in trying to apply the examples I found in the documentation: http://www.swig.org/Doc2.0/SWIGDocumentation.html#Java_struct_pointer_pointer `http://www.swig.org/Doc2.0/SWIGDocumentation.html#Java_using_typemaps_return_arguments Help!

    Read the article

  • Kohana controller shows blank page if missing URI segment/argument

    - by Petruza
    When accessing http://www.nowplayingnashville.com/event2/detail/440698386/Whatever the controller shows normally. But when omitting the last parameter (event's title, which can be any string), http://www.nowplayingnashville.com/event2/detail/440698386/ It shows blank. I added a default value and tried to hardcode the title on the first line of the controller, but it doesn't work anyway. It looks like a view issue, because I can add an echo at the end of the controller and it gets printed, so the controller is executing to the end, but the views aren't displayed. This problem is present on the live site, but I checked out the code on my local machine and it works perfectly without a title. That's strange. Could it be a Kohana or Apache configuration issue?

    Read the article

  • mysql_close(): supplied argument is not a valid MySQL-Link resource

    - by Illes Peter
    Here's what I'm trying to do: I've got a db.php file that does all the db manipulation. It has 2 static methods, connect and deconnect. In my other file i simply use db::connect() and db::deconnect(). The mysql_close($con) in the deconnect method just doesn't know who $con is. Since I don't want to instantiate my class static is the only way to go. Declaring 'private $con' in class db doesn't seem to have an effect. Any ideas? class db { public static function connect() { $dbData = parse_ini_file($_SERVER['DOCUMENT_ROOT'].'/config.ini'); $con = mysql_connect($dbData['host'],$dbData['user'],$dbData['pass']); $db = mysql_select_db($dbData['db']); if ((!$con) || (!$db)) return 0; else return 1; } public static function deconnect() { mysql_close($con); } }

    Read the article

  • Passing a JavaScript variable to a helper method

    - by Brendan Vogt
    I am using ASP.NET MVC 3 and the YUI library. I created my own helper method to redirect to an edit view by passing in the item's ID from the Model as such: window.location = '@Url.RouteUrl(Url.NewsEdit(@Model.NewsId))'; Now I am busy populating my YUI data table and would like to call my helper method like above, not sure if it is possible because I get the item's ID by JavaScript like: var formatActionLinks = function (oCell, oRecord, oColumn, oData) { var newsId = oRecord.getData('NewsId'); oCell.innerHTML = '<a href="/News/Edit/' + newsId + '">Edit</a>'; };

    Read the article

  • passing string literal to std::map::find(..)

    - by ra170
    I've got a std::map. I'm passing string literal to find method. Obviously, I can pass a string literal such as .find("blah"); However, I wanted to declare it upfront, instead of hardcoding the string, so I have couple of choices now: const std::string mystring = "blah"; const char mystring[] = "blah"; static const char * mystring = "blah"; They all work. (or at least compile). My question is, which one should I use? what's the advantage/distavantage over of the other?

    Read the article

  • Command passed as argument to shell script

    - by raj_arni
    Hi, I want to pass a command to a shell script. This command is a grep command. While executing I am getting the following errors, please help: myscript.sh "egrep 'ERROR|FATAL' \*20100428\*.log | grep -v aString" myscript.sh is a simple script: #!/bin/ksh cd log $1 the errors are: egrep: can't open | egrep: can't open grep egrep: can't open -v egrep: can't open aString Error is because egrap sees |, grep, -v and aString as arguments.

    Read the article

  • Instantiate a model when the kind of model needed is represented as a string argument

    - by indiehacker
    My input data is a string representing the kind of datastore model I want to make. In python, I am using the eval() function to instantiate the model (below code), but this seems overly complex so I was wondering if there is a simpler way people normally do this? >>>model_kind="TextPixels" >>>key_name_eval="key_name" >>>key_name="key_name" >>>kwargs {'lat': [0, 1, 2, 3], 'stringText': 'boris,ted', 'lon': [0, 1, 2, 8], 'zooms': [0, 10]} >>>obj=eval( model_type + '(key_name='+tester+ ',**kwargs )' ) >>>obj <datamodel.TextPixels object at 0xed8808c>

    Read the article

  • BizTalk - generating schema from Oracle stored proc with table variable argument

    - by Ron Savage
    I'm trying to set up a simple example project in BizTalk that gets changes made to a table in a SQL Server db and updates a copy of that table in an Oracle db. On the SQL Server side, I have a stored proc named GetItemChanges() that returns a variable number of records. On the Oracle side, I have a stored proc named Update_Item_Region_Table() designed to take a table of records as a parameter so that it can process all the records returned from GetItemChanges() in one call. It is defined like this: create or replace type itemrec is OBJECT ( UPC VARCHAR2(15), REGION VARCHAR2(5), LONG_DESCRIPTION VARCHAR2(50), POS_DESCRIPTION VARCHAR2(30), POS_DEPT VARCHAR2(5), ITEM_SIZE VARCHAR2(10), ITEM_UOM VARCHAR2(5), BRAND VARCHAR2(10), ITEM_STATUS VARCHAR2(5), TIME_STAMP VARCHAR2(20), COSTEDBYWEIGHT INTEGER ); create or replace type tbl_of_rec is table of itemrec; create or replace PROCEDURE Update_Item_Region_table ( Item_Data tbl_of_rec ) IS errcode integer; errmsg varchar2(4000); BEGIN for recIndex in 1 .. Item_Data.COUNT loop update FL_ITEM_REGION_TEST set Region = Item_Data(recIndex).Region, Long_description = Item_Data(recIndex).Long_description, Pos_Description = Item_Data(recIndex).Pos_description, Pos_Dept = Item_Data(recIndex).Pos_dept, Item_Size = Item_Data(recIndex).Item_Size, Item_Uom = Item_Data(recIndex).Item_Uom, Brand = Item_Data(recIndex).Brand, Item_Status = Item_Data(recIndex).Item_Status, Timestamp = to_date(Item_Data(recIndex).Time_stamp, 'yyyy-mm-dd HH24:mi:ss'), CostedByWeight = Item_Data(recIndex).CostedByWeight where UPC = Item_Data(recIndex).UPC; log_message(Item_Data(recIndex).Region, '', 'Updated item ' || Item_Data(recIndex).UPC || '.'); end loop; EXCEPTION WHEN OTHERS THEN errcode := SQLCODE(); errmsg := SQLERRM(); log_message('CE', '', 'Error in Update_Item_Region_table(): Code [' || errcode || '], Msg [' || errmsg || '] ...'); END; In my BizTalk project I generate the schemas and binding information for both stored procedures. For the Oracle procedure, I specified a path for the GeneratedUserTypesAssemblyFilePath parameter to generate a DLL to contain the definition of the data types. In the Send Port on the server, I put the path to that Types DLL in the UserAssembliesLoadPath parameter. I created a map to translate the GetItemChanges() schema to the Update_Item_Region_Table() schema. When I run it the data is extracted and transformed fine but causes an exception trying to pass the data to the Oracle proc: *The adapter failed to transmit message going to send port "WcfSendPort_OracleDBBinding_HOST_DATA_Procedure_Custom" with URL "oracledb://dvotst/". It will be retransmitted after the retry interval specified for this Send Port. Details:"System.InvalidOperationException: Custom type mapping for 'HOST_DATA.TBL_OF_REC' is not specified or is invalid.* So it is apparently not getting the information about the custom data type TBL_OF_REC into the Types DLL. Any tips on how to make this work?

    Read the article

  • passing parameter to view in IOS after a button is pressed

    - by ghostrider
    I am new to IOS programming. So far I have been programming in android. So in android when pressing a button code for passing an argument would be like that: Intent i = new Intent(MainScreen.this,OtherScreen.class); Bundle b = new Bundle(); b.putString("data_1",data); i.putExtras(b); startActivity(i); and on the activity that opens, i would write something like this: Bundle b = getIntent().getExtras(); ski_center=b.getString("data_1"); what methods should I need to change in MainScreen and in OtherScreen in IOS to achieve the above. Basically I will have 3 buttons lets say in my MainScreen and each of it will open the Otherview but each time a different parameter will be passed. Foe example for each button i have code like these in MainScreen.m @synthesize fl; -(IBAction) ifl:(id) sender { } So I need your help in where to place the "missing" code, too.

    Read the article

  • call inline function and pass in current item as the argument - Flex 3

    - by wcpro
    Im trying to create a loop of items like this... for each (var btn:Object in ViewButtonData) { // build element var box:HBox = new HBox(); box.styleName = "lefttab"; box.width = "100%"; box.addEventListener("rollOver", HoverTab(btn.id, 1)); box.addEventListener("rollOut", HoverTab(btn.id, 0)); // add element to list } I would like to pass in current HBox to the 'HoverTab' function. Is there a way to do that?

    Read the article

  • Perl standard input with argument inside Bash

    - by neversaint
    I want to have such pipe in bash #! /usr/bin/bash cut -f1,2 file1.txt | myperl.pl foo | sort -u Now in myperl.pl it has content like this my $argv = $ARG[0] || "foo"; while (<>) { chomp; if ($argv eq "foo") { # do something with $_ } else { # do another } } But why the Perl script can't recognize the parameter passed through bash? Namely the code break with this message: Can't open foo: No such file or directory at myperl.pl line 15. What the right way to do it so that my Perl script can receive standard input and parameter at the same time?

    Read the article

  • Python function argument scope (Dictionaries v. Strings)

    - by Shaun Meyer
    Hello, given: foo = "foo" def bar(foo): foo = "bar" bar(foo) print foo # foo is still "foo"... foo = {'foo':"foo"} def bar(foo): foo['foo'] = "bar" bar(foo) print foo['foo'] # foo['foo'] is now "bar"? I have a function that has been inadvertently over-writing my function parameters when I pass a dictionary. Is there a clean way to declare my parameters as constant or am I stuck making a copy of the dictionary within the function? Thanks!

    Read the article

  • C# Generic method type argument inference

    - by CaptainCasey
    Is there any way that I can generalise the type definitions here? Ideally, I'd like to be able to change the type of 'testInput' and have test correctly infer the type at compile time. public static void Run() { var testInput = 3; var test = ((Func<int, int>) Identity).Compose<int,int,int>(n => n)(testInput); Console.WriteLine(test); } public static Func<T, V> Compose<T, U, V>(this Func<U, V> f, Func<T, U> g) { return x => f(g(x)); } public static T Identity<T> (this T value) { return value; }

    Read the article

  • Java Web App: Passing form parameters across multiple pages

    - by digiarnie
    Hi, what is the best practice or best way of passing form parameters from page to page in a flow? If I have a flow where a user enters data in a form and hits next and repeats this process until they get to an approval page, what ways could I approach this problem to make the retention of data as simple as possible over the flow? I guess you could put all the information as you go in the session but could you get into memory issues if a lot of people are using your app and going through the flow at the same time?

    Read the article

  • Objective-C stringWithFormat misses an argument?

    - by rocity
    When I run this code: - (NSString *)description{ return [NSString stringWithFormat:@"(FROG idle:%i animating:%i rect:%@ position:%@ tongue:%@)", self.idleTime, self.animating, NSStringFromCGRect(self.rect), NSStringFromCGPoint(self.position), tongue ]; } I get the following output: (FROG idle:0 animating:0 rect:(null) position:{{1,2}{3,4}} tongue:{5,6}) This is wrong because it seems to be skipping the rect format string and placing everything displaced by one. So idle and animating are what I expect, then rect is skipped, but the result from NSStringFromCGRect(self.rect) is placed into position, then the result for position is pushed to tongue, then tongue is not displayed at all. I'm at a loss.

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >