Search Results

Search found 32130 results on 1286 pages for 'method chaining'.

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

  • Call a c# method from Javascript

    - by Luis
    Hi i want to call a C# method.. I already tryed with webmethod, but in the c# method i will not have acces to textbox or others controls. this is how i done without success.. http://www.singingeels.com/Articles/Using_Page_Methods_in_ASPNET_AJAX.aspx With static works, but i want without static, so i can access to the controls in the aspx and validate the page. how can i do it?

    Read the article

  • How to explain method calls?

    - by forki23
    Hi, let's consider a small method: int MyFunction(string foo, int bar) { ... } and some calls: MyFunction("",0) int x = MyFunction(foo1,bar1) How would you explain this to a non-technical persons? Has anybody a nice metaphor? I tried to explain method calling (or function application) several times, but I failed. Seems I can't find the right words here. Regards, forki

    Read the article

  • creating and returning an array from a method

    - by Troy
    howdy, i currently have a method that checks what is around the centre item in a 3x3 grid, if what is in the 8 adjacent positions is containing what i am checking for i want to mark that square on an array with length 7 as being 1. to do this i need to create and return an array in my method, is it possible to do this?

    Read the article

  • Using "prevent execution of method" flags

    - by tpaksu
    First of all I want to point out my concern with some pseudocode (I think you'll understand better) Assume you have a global debug flag, or class variable named "debug", class a : var debug = FALSE and you use it to enable debug methods. There are two types of usage it as I know: first in a method : method a : if debug then call method b; method b : second in the method itself: method a : call method b; method b : if not debug exit And I want to know, is there any File IO or stack pointer wise difference between these two approaches. Which usage is better, safer and why?

    Read the article

  • JUnit Easymock Unexpected method call

    - by Lancelot
    Hi, I'm trying to setup a test in JUnit w/ EasyMock and I'm running into a small issue that I can't seem to wrap my head around. I was hoping someone here could help. Here is a simplified version of the method I'm trying to test: public void myMethod() { //Some code executing here Obj myObj = this.service.getObj(param); if (myObj.getExtId() != null) { OtherObj otherObj = new OtherObj(); otherObj.setId(myObj.getExtId()); this.dao.insert(otherObj); } //Some code executing there } Ok so using EasyMock I've mocked the service.getObj(myObj) call and that works fine. My problem comes when JUnit hits the dao.insert(otherObj) call. EasyMock throws a "Unexpected Method Call" on it. I wouldn't mind mocking that dao in my test and using expectLastCall().once(); on it, but that assumes that I have a handle on the "otherObj" that's passed as a parameter at insert time... Which of course I don't since it's conditionally created within the context of the method being tested. Anyone has ever had to deal with that and somehow solved it? Thanks.

    Read the article

  • Abstract Methods in "Product" - Factory Method C#

    - by Regina Foo
    I have a simple class library (COM+ service) written in C# to consume 5 web services: Add, Minus, Divide, Multiply and Compare. I've created the abstract product and abstract factory classes. The abstract product named WS's code: public abstract class WS { public abstract double Calculate(double a, double b); public abstract string Compare(double a, double b); } As you see, when one of the subclasses inherits WS, both methods must be overridden which might not be useful in some subclasses. E.g. Compare doesn't need Calculate() method. To instantiate a new CompareWS object, the client class will call the CreateWS() method which returns a WS object type. public class CompareWSFactory : WSFactory { public override WS CreateWS() { return new CompareWS(); } } But if Compare() is not defined as abstract in WS, the Compare() method cannot be invoked. This is only an example with two methods, but what if there are more methods? Is it stupid to define all the methods as abstract in the WS class? My question is: I want to define abstract methods that are common to all subclasses of WS whereas when the factory creates a WS object type, all the methods of the subclasses can be invoked (overridden methods of WS and also the methods in subclasses). How should I do this?

    Read the article

  • Rails does not display error messages on a form in a custom method

    - by slythic
    Hi all, I've created a custom method called checkout in my app. I create an order (which is done my adding products to my "cart"), assign it to my client, and then I head to my checkout screen where I confirm the items and enter their customer order number and complete the order (submit). Everything works great except that it doesn't display error messages. I'm able to display a flash error notice (seen in complete_order method) when things go wrong but it doesn't specify the details like a normal form would. The error messages should appear if the customer order number is not unique for that client. Below is the custom method (checkout) related code. Order Model: validates_uniqueness_of :customer_order_number, :scope => :client_id Orders_controller: def checkout @order = current_order end def complete_order @order = current_order respond_to do |format| if @order.update_attributes(params[:order]) @order.complete #sets submitted datetime and state to 'complete' flash[:notice] = 'Thank you! Your order is being processed.' format.html { redirect_to( products_path ) } format.xml { head :ok } else flash[:error] = 'Please review your items' #added to confirm an error is present format.html { redirect_to( checkout_path ) } format.xml { render :xml => @order.errors, :status => :unprocessable_entity } end end end And the form in the checkout view: <% form_for @order, :url => { :controller => "orders", :action => "complete_order" } do |f| %> <%= f.error_messages %> <%= f.text_field :customer_order_number, :label => "Purchase Order Number" %> <p> <%= f.submit 'Complete Order', :confirm => 'Are you sure?' %> <small> or <%= link_to 'cancel', current_cart_path %></small> </p> <% end %> Any idea how I can display the specific error messages? Thank you in advance! -Tony

    Read the article

  • Calling a method at a specific interval rate in C++

    - by Aetius
    This is really annoying me as I have done it before, about a year ago and I cannot for the life of me remember what library it was. Basically, the problem is that I want to be able to call a method a certain number of times or for a certain period of time at a specified interval. One example would be I would like to call a method "x" starting from now, 10 times, once every 0.5 seconds. Alternatively, call method "x" starting from now, 10 times, until 5 seconds have passed. Now I thought I used a boost library for this functionality but I can't seem to find it now and feeling a bit annoyed. Unfortunately I can't look at the code again as I'm not in possession of it any more. Alternatively, I could have dreamt this all up and it could have been proprietary code. Assuming there is nothing out there that does what I would like, what is currently the best way of producing this behaviour? It would need to be high-resolution, up to a millisecond. It doesn't matter if it blocks the thread that it is executed from or not. Thanks!

    Read the article

  • How can I call a method given only its name?

    - by mfolnovich
    I'm trying to have method void run( string method ) which would run method in that class. For example: class Foo { public: void run( string method ) { // this method calls method *method* from this class } void bar() { printf( "Function bar\n" ); } void foo2() { printf( "Function foo2\n" ); } } Foo foo; int main( void ) { foo.run( "bar" ); foo.run( "foo2" ); } this would print: Function bar Function foo2 Thanks! :)

    Read the article

  • asp.net detailsview update method not getting new values

    - by Ali
    Hi all, I am binding a detailsview with objectdatasource which gets the select parameter from the querystring. The detailsview shows the desired record, but when I try to update it, my update method gets the old values for the record (and hence no update). here is my detailsview code: <asp:DetailsView ID="dvUsers" runat="server" Height="50px" Width="125px" AutoGenerateRows="False" DataSourceID="odsUserDetails" onitemupdating="dvUsers_ItemUpdating"> <Fields> <asp:CommandField ShowEditButton="True" /> <asp:BoundField DataField="Username" HeaderText="Username" SortExpression="Username" ReadOnly="true" /> <asp:BoundField DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" /> <asp:BoundField DataField="LastName" HeaderText="Last Name" SortExpression="LastName" /> <asp:BoundField DataField="Email" runat="server" HeaderText="Email" SortExpression="Email" /> <asp:BoundField DataField="IsActive" HeaderText="Is Active" SortExpression="IsActive" /> <asp:BoundField DataField="IsOnline" HeaderText="Is Online" SortExpression="IsOnline" ReadOnly="true" /> <asp:BoundField DataField="LastLoginDate" HeaderText="Last Login" SortExpression="LastLoginDate" ReadOnly="true" /> <asp:BoundField DataField="CreateDate" HeaderText="Member Since" SortExpression="CreateDate" ReadOnly="true" /> <asp:TemplateField HeaderText="Membership Ends" SortExpression="ExpiryDate"> <EditItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ExpiryDate") %>'></asp:TextBox> <cc1:CalendarExtender ID="TextBox1_CalendarExtender" runat="server" Enabled="True" TargetControlID="TextBox1"> </cc1:CalendarExtender> </EditItemTemplate> <InsertItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ExpiryDate") %>'></asp:TextBox> </InsertItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("ExpiryDate") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> </Fields> and here is the objectdatasource code: <asp:ObjectDataSource ID="odsUserDetails" runat="server" SelectMethod="GetAllUserDetailsByUserId" TypeName="QMS_BLL.Membership" UpdateMethod="UpdateUserForClient"> <UpdateParameters> <asp:Parameter Name="User_ID" Type="Int32" /> <asp:Parameter Name="firstName" Type="String" /> <asp:Parameter Name="lastName" Type="String" /> <asp:SessionParameter Name="updatedByUser" SessionField="userId" DefaultValue="1" /> <asp:Parameter Name="expiryDate" Type="DateTime" /> <asp:Parameter Name="Email" Type="String" /> <asp:Parameter Name="isActive" Type="String" /> </UpdateParameters> <SelectParameters> <asp:QueryStringParameter DefaultValue="1" Name="User_ID" QueryStringField="User_ID" Type="Int32" /> </SelectParameters> </asp:ObjectDataSource> Is the OnItemUpdating method still required when you have your custom BLL method called on insertevent? (which is being executed fine in my case but updating with the old values) or am I missing something else? Also I tried to provide an OnItemUpdating method and in there I tried to capture the contents of the textboxes (the new values). I got an exception: "Specified argument was out of the range of valid values. Parameter name: index" when I tried to do: TextBox txtFirstName = (TextBox)dvUsers.Rows[1].Cells[1].Controls[0]; Any help will be most appreciated.

    Read the article

  • Does Java support dynamic method invocation?

    - by eSKay
    class A { void F() { System.out.println("a"); }} class B extends A { void F() { System.out.println("b"); }} public class X { public static void main(String[] args) { A objA = new B(); objA.F(); } } Here, F() is being invoked dynamically, isn't it? This article says ... the Java bytecode doesn’t support dynamic method invocation. There are three supported invocations modes : invokestatic, invokespecial, invokeinterface or invokevirtual. These modes allows to call methods with known signature. We talk of strongly typed language. This allows to to make some checks directly at compile time. On the other side, the dynamic languages use dynamic types. So we can call a method unknown at the compile time, but that’s completely impossible with the Java bytecode. What am I missing?

    Read the article

  • Java and junit: derivative of polynomial method testing issue

    - by Curtis
    Hello all, im trying to finish up my junit testing for finding the derivative of a polynomial method and im having some trouble making it work. here is the method: public Polynomial derivative() { MyDouble a = new MyDouble(0); MyDouble b = this.a.add(this.a); MyDouble c = this.b; Polynomial poly = new Polynomial (a, b, c); return poly; } and here is the junit test: public void testDerivative() { MyDouble a = new MyDouble(2), b = new MyDouble(4), c = new MyDouble(8); MyDouble d = new MyDouble(0), e = new MyDouble(4), f = new MyDouble(4); Polynomial p1 = new Polynomial(a, b, c); Polynomial p2 = new Polynomial(d,e,f); assertTrue(p1.derivative().equals(p2)); } im not too sure why it isnt working...ive gone over it again and again and i know im missing something. thank you all for any help given, appreciate it

    Read the article

  • How to find minimum of nonlinear, multivariate function using Newton's method (code not linear algeb

    - by Norman Ramsey
    I'm trying to do some parameter estimation and want to choose parameter estimates that minimize the square error in a predicted equation over about 30 variables. If the equation were linear, I would just compute the 30 partial derivatives, set them all to zero, and use a linear-equation solver. But unfortunately the equation is nonlinear and so are its derivatives. If the equation were over a single variable, I would just use Newton's method (also known as Newton-Raphson). The Web is rich in examples and code to implement Newton's method for functions of a single variable. Given that I have about 30 variables, how can I program a numeric solution to this problem using Newton's method? I have the equation in closed form and can compute the first and second derivatives, but I don't know quite how to proceed from there. I have found a large number of treatments on the web, but they quickly get into heavy matrix notation. I've found something moderately helpful on Wikipedia, but I'm having trouble translating it into code. Where I'm worried about breaking down is in the matrix algebra and matrix inversions. I can invert a matrix with a linear-equation solver but I'm worried about getting the right rows and columns, avoiding transposition errors, and so on. To be quite concrete: I want to work with tables mapping variables to their values. I can write a function of such a table that returns the square error given such a table as argument. I can also create functions that return a partial derivative with respect to any given variable. I have a reasonable starting estimate for the values in the table, so I'm not worried about convergence. I'm not sure how to write the loop that uses an estimate (table of value for each variable), the function, and a table of partial-derivative functions to produce a new estimate. That last is what I'd like help with. Any direct help or pointers to good sources will be warmly appreciated. Edit: Since I have the first and second derivatives in closed form, I would like to take advantage of them and avoid more slowly converging methods like simplex searches.

    Read the article

  • Java input method for Virtual Keyboad

    - by shekhar
    Hi, I am facing problem in implementing Input method for Virtual Keyboard, currently I am using robot class for sending input to any application from virtual keyboard. but for that I need to create mapping of key-code and unicode, which is not consistent on different keyboard layout, can I directly pass the UNICODE to any application using Input method without worry about mapping between keycode and unicode. any useful link or sample code will be useful. It is simple Java program which is always on top of any application and work as onscreen keyboard. using a mouse while you press any button (key) of the keyboard, the corresponding character will be typed in the application running below. This is working perfectly for English Alphabets. I am facing problem while I am doing for unicode.

    Read the article

  • Objective-C method implementation nuances

    - by altdotnetgeek
    I have just started to develop for the iPhone and am in the process of learning Objective-C. I have seen some code that implements a method in the @implementation side of a class like this: -(void)myMethod; { // method body } What makes this interesting is that there is no mention of myMethod in the @interface for the class. I tried a sample project with this and when I compile I get a warning from XCode that myMethod may not be seen by the calling code. Can anyone tell me what is going on? Thanks!

    Read the article

  • execute javascript method after completing code behind method ?

    - by James123
    I can execute below callback() method after completion of document.getElementById('btnDownload').click(); .This Click is Code behind method. Now it is executing immediatly. I want wait "Click()" process done then Execute callback(); method. function LoadPopup() { // find the popup behavior this._popup = $find('mdlPopup'); // show the popup this._popup.show(); // synchronously run the server side validation ... document.getElementById('btnDownload').click(); callback(); } function callback() { this._popup = $find('mdlPopup'); // hide the popup this._popup.hide(); alert("hi"); }

    Read the article

  • Java method overloading + double dispatch

    - by Max
    Can anybody explain in detail the reason the overloaded method print(Parent parent) is invoked when working with Child instance in my test piece of code? Any pecularities of virtual methods or methods overloading/resolution in Java involved here? Any direct reference to Java Lang Spec? Which term describes this behaviour? Thanks a lot. public class InheritancePlay { public static class Parent { public void doJob(Worker worker) { System.out.println("this is " + this.getClass().getName()); worker.print(this); } } public static class Child extends Parent { } public static class Worker { public void print(Parent parent) { System.out.println("Why this method resolution happens?"); } public void print(Child child) { System.out.println("This is not called"); } } public static void main(String[] args) { Child child = new Child(); Worker worker = new Worker(); child.doJob(worker); } }

    Read the article

  • overriding protected internal with protected!

    - by Asad Butt
    This is an extension for this question asked an hour ago. We cannot modify the access modifiers, when overriding a virtual method in derived class. Consider Control class in System.Web.UI namespace public class Control : IComponent, IDisposable,... { protected internal virtual void CreateChildControls() { } . . } Now Consider This public class someClass : System.Web.UI.Control { // This should not compile but it does protected override void CreateChildControls() { } // This should compile but it does not protected internal override void CreateChildControls() { } } can any body explain this ? Thanks

    Read the article

  • Calling overridden parent method from parent method

    - by Yisroel
    Heres the situation. Component B extends component A and overrides the init method to accept a different parameter. A also has a create method that calls init. If i have an instance of B and i call create, its calling the wrong init - it calls init in B, where i need it to call init in A. I dont want to call super.init() as there may not always be a super. Is there any way to specify to call the init in the parent component?

    Read the article

  • Java method keyword "final" and its use

    - by Lukas Eder
    When I create complex type hierarchies (several levels, several types per level), I like to use the final keyword on methods implementing some interface declaration. An example: interface Garble { int zork(); } interface Gnarf extends Garble { /** * This is the same as calling {@link #zblah(0)} */ int zblah(); int zblah(int defaultZblah); } And then abstract class AbstractGarble implements Garble { @Override public final int zork() { ... } } abstract class AbstractGnarf extends AbstractGarble implements Gnarf { // Here I absolutely want to fix the default behaviour of zblah // No Gnarf shouldn't be allowed to set 1 as the default, for instance @Override public final int zblah() { return zblah(0); } // This method is not implemented here, but in a subclass @Override public abstract int zblah(int defaultZblah); } I do this for several reasons: It helps me develop the type hierarchy. When I add a class to the hierarchy, it is very clear, what methods I have to implement, and what methods I may not override (in case I forgot the details about the hierarchy) I think overriding concrete stuff is bad according to design principles and patterns, such as the template method pattern. I don't want other developers or my users do it. So the final keyword works perfectly for me. My question is: Why is it used so rarely in the wild? Can you show me some examples / reasons where final (in a similar case to mine) would be very bad?

    Read the article

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