Search Results

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

Page 49/297 | < Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >

  • Passing through lists from jQuery to the service

    - by thedixon
    I'm sure I've done this in another solution, but I can't seem to find any solution as to do it again and wondered if anyone can help me... This is my WebAPI code: public class WebController : ApiController { public void Get(string telephone, string postcode, List<Client> clients) { } } And, calling this from jQuery: function Client(name, age) { this.Name = name; this.Age = age; } var Clients = []; Clients.push(new Client("Chris", 27)); $.ajax({ url: "/api/Web/", data: { telephone: "999", postcode: "xxx xxx", clients: Clients } }); But the "clients" object always comes back as null. I've also tried JSON.stringify(Clients), and this is the same result. Can anyone see anything obvious I'm missing here?

    Read the article

  • Passing mix of T and T[] to a Java varargs method

    - by rfalke
    Suppose you have a Java method void foobar(int id, String ... args) and want to pass both String arrays and Strings into the method. Like this String arr1[]={"adas", "adasda"}; String arr2[]={"adas", "adasda"}; foobar(0, "adsa", "asdas"); foobar(1, arr1); foobar(2, arr1, arr2); foobar(3, arr1, "asdas", arr2); In Python there is "*" for this. Is there some way better than such rather ugly helper method: static String[] concat(Object... args) { List<String> result = new ArrayList<String>(); for (Object arg : args) { if (arg instanceof String) { String s = (String) arg; result.add(s); } else if (arg.getClass().isArray() && arg.getClass().getComponentType().equals(String.class)) { String arr[] = (String[]) arg; for (String s : arr) { result.add(s); } } else { throw new RuntimeException(); } } return result.toArray(new String[result.size()]); } which allows foobar(4, concat(arr1, "asdas", arr2));

    Read the article

  • Trouble Passing Parameter to LinqToSql Stored Procedure

    - by Webjedi
    public IEnumerable<T> ExecuteStoredProcedure<T>(params object[] parameters) { Type genericType = typeof(T); string commandthing = genericType.Name.Replace("Result", ""); //_db is my Linq To Sql database return _db.ExecuteQuery<T>(commandthing, parameters).AsEnumerable(); } The stored procedure is named GetOrder and has a single int parameter of orderid. I'm calling the above like so: SqlParameter parm1 = new SqlParameter("@orderid", SqlDbType.Int); parm1.Value = 123; var results = _session.ExecuteStoredProcedure<GetOrderResult>(parm1).Single(); I'm receiving the following error: A query parameter cannot be of type 'System.Data.SqlClient.SqlParameter' Thoughts? Or am I just missing something obvious?

    Read the article

  • Passing data to a jQuery click() function

    - by jakenoble
    Hi I have a simple span like so <span class="action removeAction">Remove</span> This span is within a table, each row has a remove span. And then I call a URL using AJAX when that span is clicked. The AJAX event needs to know the ID of the object for that row? What is the best way of getting that ID into the click function? I thought I could do something like this <span class="action removeAction" id="1">Remove</span> But an ID should not start with a number? Right? Then I thought I could do <span class="action removeAction" id="my1">Remove</span> Then just strip the 'my' part from the ID, but that just seems Yuk! Below is my click event and where my AJAX event is. <script type="text/javascript" language="text/javascript"> $(document).ready(function() { $(".removeAction").click(function() { //AJAX here that needs to know the ID } }); </script> I am sure there is a nice way of doing this? Thanks. Jake.

    Read the article

  • passing parameters to a thread

    - by assassin
    I want to pass a function that takes a parameter to the ThreadStart Constructor in C#. But, it seems that this is not possible, as I get a syntax error it I try to do something like this Thread t1 = new Thread(new Thread Start(func1(obj1)); where obj1 is an object of type List<string> (say). If I want a thread to execute this function that takes in an object as a parameter, and I plan to create 2 such threads simultaneously with different parameter values what is the best method to achieve this?

    Read the article

  • Passing windows credentials through web application, to WCF

    - by IP
    I've checked other questions, but I can't find a working answer I have a .Net web application which successfully takes on the callers windows credentials (Thread.CurrentPrincipal is my windows user). Within that app, I call to a WCF service, but my windows identity isn't passed up. Regardless of what I put in the binding: NetTcpBinding binding = new NetTcpBinding(); binding.Security.Mode = SecurityMode.Transport; binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows;

    Read the article

  • Java Thread Message Passing

    - by pkulak
    I'm writing an Android app. I have a main method, which creates and runs a new Thread using an anonymous inner Runnable class. The run() method, when it's done, calls a method on it's parent class (in the main thread) that calls notifyDataSetChanged() so that the main thread can redraw the new data. This is causing all kinds of trouble (ViewRoot$CalledFromWrongThreadException). The thing is, this method being called from the worker thread is on the class that's created in the UI thread. Shouldn't that be running on the UI thread? Or am I missing something? Here's some code about what I'm talking about: public class Mealfire extends Activity { @Override public void onCreate(Bundle icicle) { (new Thread() { public void run() { // Do a bunch of slow network stuff. update(); } }).start(); } private void update() { myAdapter.notifyDatasetChanged(); } }

    Read the article

  • Passing C++ object to C++ code through Python?

    - by cornail
    Hi all, I have written some physics simulation code in C++ and parsing the input text files is a bottleneck of it. As one of the input parameters, the user has to specify a math function which will be evaluated many times at run-time. The C++ code has some pre-defined function classes for this (they are actually quite complex on the math side) and some limited parsing capability but I am not satisfied with this construction at all. What I need is that both the algorithm and the function evaluation remain speedy, so it is advantageous to keep them both as compiled code (and preferrably, the math functions as C++ function objects). However I thought of glueing the whole simulation together with Python: the user could specify the input parameters in a Python script, while also implementing storage, visualization of the results (matplotlib) and GUI, too, in Python. I know that most of the time, exposing C++ classes can be done, e.g. with SWIG but I still have a question concerning the parsing of the user defined math function in Python: Is it possible to somehow to construct a C++ function object in Python and pass it to the C++ algorithm? E.g. when I call f = WrappedCPPGaussianFunctionClass(sigma=0.5) WrappedCPPAlgorithm(f) in Python, it would return a pointer to a C++ object which would then be passed to a C++ routine requiring such a pointer, or something similar... (don't ask me about memory management in this case, though :S) The point is that no callback should be made to Python code in the algorithm. Later I would like to extend this example to also do some simple expression parsing on the Python side, such as sum or product of functions, and return some compound, parse-tree like C++ object but let's stay at the basics for now. Sorry for the long post and thx for the suggestions in advance.

    Read the article

  • Grid View Button Passing Data Via On Click

    - by flyersun
    Hi, I'm pretty new to C# and asp.net so aplogies if this is a really stupid question. I'm using a grid view to display a number of records from a database. Each row has an Edit Button. When the button is clicked I want an ID to be passed back to a funtion in my .cs file. How do I bind the rowID to the Button field? I've tired using a hyper link instead but this doens't seem to work because I'm posting back to the same page which already has a Permanter on the URL. asp.net <asp:GridView ID="gvAddresses" runat="server" onrowcommand="Edit_Row"> <Columns> <asp:ButtonField runat="server" ButtonType="Button" Text="Edit"> </Columns> </asp:GridView> c# int ImplantID = Convert.ToInt32(Request.QueryString["ImplantID"]); Session.Add("ImplantID", ImplantID); List<GetImplantDetails> DataObject = ImplantDetails(ImplantID); System.Data.DataSet DSImplant = new DataSet(); System.Data.DataTable DTImplant = new DataTable("Implant"); DSImplant.Tables.Add(DTImplant); DataColumn ColPostCode = new DataColumn(); ColPostCode.ColumnName = "PostCode"; ColPostCode.DataType = typeof(string); DTImplant.Columns.Add(ColPostCode); DataColumn ColConsigneeName = new DataColumn(); ColConsigneeName.ColumnName = "Consignee Name"; ColConsigneeName.DataType = typeof(string); DTImplant.Columns.Add(ColConsigneeName); DataColumn ColIsPrimaryAddress = new DataColumn(); ColIsPrimaryAddress.ColumnName = "Primary"; ColIsPrimaryAddress.DataType = typeof(int); DTImplant.Columns.Add(ColIsPrimaryAddress); DataColumn ColImplantCustomerDetailsID = new DataColumn(); ColImplantCustomerDetailsID.ColumnName = "Implant ID"; ColImplantCustomerDetailsID.DataType = typeof(int); DTImplant.Columns.Add(ColImplantCustomerDetailsID); foreach (GetImplantDetails Object in DataObject) { DataRow DRImplant = DTImplant.NewRow(); DRImplant["PostCode"] = Object.GetPostCode(); DRImplant["Consignee Name"] = Object.GetConsigneeName(); DRImplant["Primary"] = Object.GetIsPrimaryAddress(); DRImplant["Implant ID"] = Object.GeTImplantCustomerDetailsID(); DTImplant.Rows.Add(DRImplant); <--- this is what I need to be added to the button } gvAddresses.DataSource = DTImplant; gvAddresses.DataBind();

    Read the article

  • Passing $_GET or $_POST data to PHP script that is run with wget

    - by Matt
    Hello, I have the following line of PHP code which works great: exec( 'wget http://www.mydomain.com/u1.php /dev/null &' ); u1.php acts to do various types of maintenance on my server and the above command makes it happen in the background. No problems there. But I need to pass variable data to u1.php before it's executed. I'd like to pass POST data preferably, but could accommodate GET or SESSION data if POST isn't an option. Basically the type of data being passed is user-specific and will vary depending on who is logged in to the site and triggering the above code. I've tried adding the GET data to the end of the URL and that didn't work. So how else might I be able to send the data to u1.php? POST data preferred, SESSION data would work as well (but I tried this and it didn't pick up the logged in user's session data). GET would be a last resort. Thanks!

    Read the article

  • Passing additional data value to strongly typed partial views in ASP.NET MVC

    - by fearofawhackplanet
    I have an OrderForm domain class, which has property subclasses, something like: interface IOrderForm { int OrderId { get; } ICustomerDetails CustomerDetails { get; set; } IDeliveryDetails DeliveryDetails{ get; set; } IPaymentsDetails PaymentsDetails { get; set; } IOrderDetails OrderDetails { get; set; } } My "Details" view is strongly typed inheriting from IOrderForm. I then have a strongly type partial for rendering each section: <div id="CustomerDetails"> <% Html.RenderPartial("CustomerDetails", Model.CustomerDetails); %> </div> <div id="DeliveryDetails"> <% Html.RenderPartial("DeliveryDetails", Model.DeliveryDetails); %> </div> ... etc This works ok up to this point, but I'm trying to add some nice ajax bits for updating some parts of the order form, and I've realised that each of my partial views also needs access to the IOrderForm.OrderId. Whats the easiest way to give my partials access to this value?

    Read the article

  • Passing PHP session variable to AJAX URL

    - by user547794
    Hello, I am trying to pass a session variable into an AJAX loaded page. Here is the code I am using: jQuery(document).ready(function(){ $("#userdetail").click(function() { $.ajax({ url: "userdetail.php?id=<?php $_SESSION['uid']?>", success: function(msg){ $("#results").html(msg); } }); }); }); This is the HTML URL I had working, not sure how to get this into the AJAX call: userdetail.php?id=<?php $_SESSION['uid']?> I should also mention that if I manually pass in the userID it works fine url: "userdetail.php?id=1",

    Read the article

  • Passing around a SqlConnection

    - by Chris
    I have created a TransactionScope and within the scope various items are created and updated in the database. During this process I make a lot of calls to the database. Originally I opened a SqlConnection in the beginning of the TransactionScope and passed it around to any function that made a DB call then I closed the connection after all the calls are made and before the transaction commits. Is it better to do this or to open and close a connection for each call?

    Read the article

  • Sharepoint Document Upload Page - Passing URL Variables?

    - by Corey O.
    Throughout my SharePoint site, I have several document repositories that are tied to primary keys from an external database. I have added custom columns in the document library metadata fields so that we will know which SharePoint documents correspond with which table entries. As a requirement, we need to have document uploads that have these fields automatically populated. For instance, I'd like to have the following url: ./Upload.aspx?ClassID=2&SystemID=63 So that when you upload any documents to this library, it automatically adds the ClassID and SystemID values to the corresponding ClassID and SystemID columns outlined in the SharePoint document library fields. Is there any quick or easy way to do this, or will I have to completely rewrite the Upload.aspx script from scratch?

    Read the article

  • C#: Passing data to forms UI using BeginInvoke

    - by Bi
    Hi I am a C# newbie and have a class that needs to pass row information to a grid in the windows form. What is the best way to do it? I have put in some example code for better understanding. Thanks. public class GUIController { private My_Main myWindow; public GUIController( My_Main window ) { myWindow = window; } public void UpdateProducts( List<myProduct> newList ) { object[] row = new object[3]; foreach (myProduct product in newList) { row[0] = product.Name; row[1] = product.Status; row[2] = product.Day; //HOW DO I USE BeginInvoke HERE? } } } And the form class below: public class My_Main : Form { //HOW DO I GO ABOUT USING THIS DELEGATE? public delegate void ProductDelegate( string[] row ); public static My_Main theWindow = null; static void Main( ) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); theWindow = new My_Main(); Application.Run(theWindow); } private void My_Main_Load( object sender, EventArgs e ) { /// Create GUIController and pass the window object gui = new GUIController( this ); } public void PopulateGrid( string[] row ) { ProductsGrid.Rows.Add(row); ProductsGrid.Update(); } } Thanks!

    Read the article

  • Passing object through WCF so that server receives client changes

    - by cvig
    I would like to set up a WCF service so that any changes a client makes to an object I send them are also reflected on the server side. For example, if Assembly A has the following... namespace AssemblyA { public class Person { public string FirstName { get; set; } public string LastName { get; set; } } [ServiceContract] public interface IServer { [OperationContract] Person GetPerson(); } } And Assembly B references Assembly A... using AssemblyA; namespace AssemblyB { class Program { static void Main(string[] args) { <snip> IServer server = factory.CreateChannel(); Person person = server.GetPerson(); person.FirstName = "Kilroy"; person.LastName = "WuzHere"; } } } What is the easiest/best way to make it so that the service's copy of the Person object also reflects the changes that the client makes? Is this even possible?

    Read the article

  • Passing an array of an array of char to a function

    - by L.A. Rabida
    In my program, I may need to load a large file, but not always. So I have defined: char** largefilecontents; string fileName="large.txt"; When I need to load the file, the program calles this function: bool isitok=LoadLargeFile(fileName,largefilecontents); And the function is: bool LoadLargeFile(string &filename, char ** &lines) { if (lines) delete [] lines; ifstream largeFile; #ifdef LINUX largeFile.open(filename.c_str()); #endif #ifdef WINDOWS largeFile.open(filename.c_str(),ios::binary); #endif if (!largeFile.is_open()) return false; lines=new char *[10000]; if (!lines) return false; largeFile.clear(); largeFile.seekg(ios::beg); for (int i=0; i>-1; i++) { string line=""; getline(largeFile,line); if (largeFile.tellg()==-1) break; //when end of file is reached, tellg returns -1 lines[i]=new char[line.length()]; lines[i]=const_cast<char*>(line.c_str()); cout << lines[i] << endl; //debug output } return true; } When I view the debug output of this function, "cout << lines[i] << endl;", it is fine. But when I then check this in the main program like this, it is all messed up: for (i=0; i<10000; i++) cout << largefilecontents[i] << endl; So within the function LoadLargeFile(), the results are fine, but without LoadLargeFile(), the results are all messed up. My guess is that the char ** &lines part of the function isn't right, but I do not know what this should be. Could someone help me? Thank you in advance!

    Read the article

  • passing session id via url

    I'm trying to get my script to use url session id instead of cookies. The following page is not picking up the variable in the url as the session id. I must be missing something. First page http://www.website.com/start.php ini_set("session.use_cookies",0); ini_set("session.use_trans_sid",1); session_start(); $session_id = session_id(); header("location: target.php?session_id=". $session_id ); Following page - http://www.website.com/target.php?session_id=rj3ids98dhpa0mcf3jc89mq1t0 ini_set("session.use_cookies",0); ini_set("session.use_trans_sid",1); print_r($_SESSION); print(session_id()) Result is a different session id and the session is blank. Array ( [debug] = no ) pt1t38347bs6jc9ruv2ecpv7o2

    Read the article

  • Passing parameters in VBA for Access

    - by Newbie
    In Access 2007 I have created a form with a textbox and a button. At the moment, when I press the button, I load a query with the textbox data passed as a parameter to the query criteria. I would like to change this so that all (manually input) options appear in a combobox (in place of the textbox). I would then like to pass the combobox text to a VBA module upon pressing the button. How do I do this? Similarly, I hope to output a different string from this module, and I hope to use this as the query criteria. How do I do this?

    Read the article

  • Passing a column name instead of index in sqlite3

    - by user271753
    The problem code: NSString *query = @"SELECT Name FROM Category"; sqlite3_stmt *statement; if (sqlite3_prepare_v2(database, [query UTF8String], -1, &statement, nil) == SQLITE_OK) { while (sqlite3_step(statement) == SQLITE_ROW) { char *row =(char *)sqlite3_column_text(statement,0); char *rowData = (char *)sqlite3_column_text(statement,1); NSString *fieldName = [[NSString alloc] initWithUTF8String:row]; NSString *fieldValue = [[NSString alloc] initWithUTF8String:rowData]; NSLog(@"%@",fieldName); NSLog(@"%@",fieldValue); [fieldName release]; [fieldValue release]; } sqlite3_finalize(statement); } char *row =(char *)sqlite3_column_text(statement,0); In the above code instead of 0 can't I just pass a column name? How can I do that ?

    Read the article

  • Problem with RSA-encrypting a string in PHP and passing it to .NET service

    - by jonasaxelsson
    I need to call a web service that requires a login url containing an RSA encrypted, base_64 encoded and url-encoded login data. I don't have a formal php training, but even for me it seems like an easy task, however when calling the service I get an 'Invalid Format' response. What am I doing wrong and is there another way to come up with the encrypted string? Code example below. Thank you for your help! http://www.edsko.net/misc/ for encryption. $message = '?id=112233&param1=hello&[email protected]&name=Name'; $keyLength = '2048'; $exponent = '65537'; $modulus = '837366556729991345239927764652........'; $encryptedData = rsa_encrypt($message, $exponent, $modulus, $keyLength); $data = urlencode(base64_encode($encryptedData)); $loginurl = 'http://www.somedomain.com/LoginWB.aspx?Id=9876&Data='.$data; echo '<iframe src="'.$loginurl.'" width="570px" height="800px">'; echo '</iframe>'; ?

    Read the article

  • AS 2.0 - Passing xml file path as a flashvars in onClipEvent

    - by Anaya
    Hi, I want to pass xml file path dynamically using flashvars. It works ok in Onrollover and Onrollout events. But not in onClipEvent. Below is the code I am using - onClipEvent (load) { cnetXML = new XML(); cnetXML.ignoreWhite = true; cnetXML.onLoad=extractData; var xmlfile = xmlpath; cnetXML.load(xmlfile); function extractData(success) { rootHandler=this.firstChild.childNodes[23].childNodes[5].firstChild.nodeValue; if (rootHandler) gotoAndStop(2); } } If I replace xmlpath in above script with actual link, it works ok. Please let me know what I am missing here? Thanks in advance for your time! Kind Regards

    Read the article

  • passing back answers in prolog

    - by AhmadAssaf
    i have this code than runs perfectly .. returns a true .. when tracing the values are ok .. but its not returning back the answer .. it acts strangely when it ends and always return empty list .. uninstantiated variable .. test :- extend(4,12,[4,3,1,2],[[1,5],[3,4],[6]],_ExtendedBins). %printing basic information about the extend(NumBins,Capacity,RemainingNumbers,BinsSoFar,_ExtendedBins) :- getNumberofBins(BinsSoFar,NumberOfBins), msort(RemainingNumbers,SortedRemaining),nl, format("Current Number of Bins is :~w\n",[NumberOfBins]), format("Allowed Capacity is :~w\n",[Capacity]), format("maximum limit in bin is :~w\n",[NumBins]), format("Trying to fit :~w\n\n",[SortedRemaining]), format("Possible Solutions :\n\n"), fitElements(NumBins,NumberOfBins, Capacity,SortedRemaining,BinsSoFar,[]). %this is were the creation for possibilities will start %will check first if the number of bins allowed is less than then %we create a new list with all the possible combinations %after that we start matching to other bins with capacity constraint fitElements(NumBins,NumberOfBins, Capacity,RemainingNumbers,Bins,ExtendedBins) :- ( NumberOfBins < NumBins -> print('Creating new set: '); print('Sorry, Cannot create New Sets')), createNewList(Capacity,RemainingNumbers,Bins,ExtendedBins). createNewList(Capacity,RemainingNumbers,Bins,ExtendedBins) :- createNewList(Capacity,RemainingNumbers,Bins,[],ExtendedBins), print(ExtendedBins). createNewList(0,Bins,Bins,ExtendedBins,ExtendedBins). createNewList(_,[],_,ExtendedBins,ExtendedBins). createNewList(Capacity,[Element|Rest],Bins,Temp,ExtendedBins) :- conjunct_to_list(Element,ListedElement), append(ListedElement,Temp,NewList), sumlist(NewList,Sum), (Sum =< Capacity, append(ListedElement,ExtendedBins,Result); Capacity = 0), createNewList(Capacity,Rest,Bins,NewList,Result). fit(0,[],ExtendedBins,ExtendedBins). fit(Capacity,[Element|Rest],Bin,ExtendedBins) :- conjunct_to_list(Element,Listed), append(Listed,Bin,NewBin), sumlist(NewBin,Sum), (Sum =< Capacity -> fit(Capacity,Rest,NewBin,ExtendedBins); Capacity = 0, append(NewBin,ExtendedBins,NewExtendedBins), print(NewExtendedBins), fit(0,[],NewBin,ExtendedBins)). %get the number of bins provided getNumberofBins(List,NumberOfBins) :- getNumberofBins(List,0,NumberOfBins). getNumberofBins([],NumberOfBins,NumberOfBins). getNumberofBins([_List|Rest],TempCount,NumberOfBins) :- NewCount is TempCount + 1, %calculate the count getNumberofBins(Rest,NewCount,NumberOfBins). %recursive call %Convert set of terms into a list - used when needed to append conjunct_to_list((A,B), L) :- !, conjunct_to_list(A, L0), conjunct_to_list(B, L1), append(L0, L1, L). conjunct_to_list(A, [A]). Greatly appreciate the help

    Read the article

< Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >