callback

jQuery 'reverse callback' from ASP page

OK, I have a need to send a large request to a server running ASP::PERL and to have the server post back progress to the calling page. Basically -> tell server to upload a whole bunch of files in a file share, then update a div on the client as each file is checked for error/uploaded/success or fail. Is there a way to put some callback...

C# exception when calling callback function

I've made this to call unmanaged function from C code. pCallback is a function pointer so on the managed side is a delegate. [DllImport("MyDLL.dll")] public static extern Result SetCallback( IntPtr handle, Delegate pCallback, CallbackType Type); Now I am setting private delegate void pfnCallback(u...

creating actions based on specific fields having specific values

Imagine I have a C# app sitting on a server somewhere that is creating instances of the Item class and publishing them on a messaging service. class Item { public int ID1, ID2, ID3; public double Value1, Value2, Value3; } Now I have another C# app on a desktop somewhere listening to these messages. I want to be able to create ...

Call backs in Rails

I can't find very good intros to specific callbacks in rails. Basically I'm dealing with two models: Order Item, (nested in Order form) I'm using the before_update model to do some basic math: class Order < ActiveRecord::Base accepts_nested_attributes_for :line_items before_update :do_math protected def do_math ...

CallBack function from c# to c++

Hi All, I have a C# exe and some vc++ dll's . I am creating a callBackFunction in C# whichh takes structure as its Parameters. My c++ dll will fill this structure and return it back.But 95% of the time My Exe crashes. My dll is multi threaded and my C# has backgroundWorker in it. I have put try catch block to check if any exceptions are...

Javascript: What does the function given to setTimeout get called with?

I have code like this: setTimeout(foo, 600); I always thought that foo didn't take any arguments, e.g.: function foo() { /* bars */ } However, doing the following: function foo(a) { alert(a); /* bars */ } Popped up an alert displaying -7. What does this number represent? ...

[How-to] Call back a function in the original class

Hey guys, I found some useful information on the web but I still can't manage to do it by myself ;) Ok, let me put my problem in context for you : I have a first class (myViewController) whose declaration is below : // i just give you relevant information RssParser *rssParser; UIActivityIndicator *activityIndicator; In my viewDidL...

Callback functions in c++

In c++, when and how to use a callback function? EDIT: I would like to see a simple example to write a callback function. ...

How to hide an element with slide effect in a specific direction with using a callback function?

I'm using JQuery to hide an element with slide effect like this: $(".teaser_container:visible").hide("slide", function() { doSomething(); }); This works fine, but slides the element to the left. I want to slide it to the right, but can't find any example/syntax how to do this. ...

What would you call "callback" or "closure" in general?

Which keyword / tag should we use to describe them when we're taking notes for them. If they are placed under the category "software design", is it appropriate? @edit: It's more about how you category things. When you are in learning, some terminology appears, so what category will you assign it in your own ontology? ...

Ruby on Rails custom Observer

Could anyone advise how to use custom observer or events/callbacks in Ruby on Rails? I have tried both these posts: http://www.mutuallyhuman.com/2009/1/6/using-custom-activerecord-events-callbacks and http:// alexkira.blogspot.com/2008/10/custom-observer-callbacks-in-rails.html none seems to be working. On the second post, I put Alex ...

Creating associated models on create in Rails?

I have to be dead tired because I really can't figure out such simple task as this. Having: class Account < ActiveRecord::Base has_one :subscription, :dependent => :destroy after_save :append_subscription private def append_subscription # TODO end end # Subscription(id: integer, account_id: integer, level: integer (: ...

Rails callbacks (after_create)

Hey. I would like ActiveRecord to et some DB field automatically using callbacks. class Product < ActiveRecord::Base after_create :set_locale def set_locale self.locale = I18n.locale end end In ./script/console I do p = Product.create p Field p.locale is not set. What did I do wrong? Thx for help! ...

How can I know when the content imported via jQuery's .load() method are done completely loading?

I'm working on a website concept that utilizes David DeSandro's jQuery Masonry plugin along with some code inspired by Paul Irish's Infinite Scroll plugin (I couldn't get the plugin to work so I wrote something similar myself). I've done the integration so the basic concept that I have does work. I'm firing jQuery's .load() method when...

Prevent Exceptions From WCF Callbacks

I'm making a small chat application. I got to the point where one client sends a message, and then by using callbacks of other clients in the room, they quickly recieve the message. So, if there are 10 people in the room, the service instance of the client who is sending the message, will invoke this in 10 threads: targetCallback.Reciev...

Java: Is it common practice to create a new Thread when a lock is held?

Hi all, I've got a question related but not identical to my first question ever here: http://stackoverflow.com/questions/2340114/java-what-happens-when-a-new-thread-is-started-from-a-synchronized-block Is it a common practice to create and start() a new Thread when you're holding a lock? Would that be a code smell? Basically I've g...

Java: Filtering out duplicate events

I was wondering if the following is common for "regular" Java applications when receiving callback/events. Those callbacks may be triggered by user input but also by other means so it is not only related to UI events: public void handleEvent( @NotNull final SomeEvent e ) { final boolean process; synchronized ( this ) { p...

Why doesn't validation in a model referenced by a callback cause my original transaction to fail?

I have a model with an after_create callback. This callback causes a new record to be created in another model. However if a validation fails in the child record creation, the original transaction is still being saved. This doesn't seem right. According to Rails docs the whole thing is wrapped in a transaction. Am I doing something wron...

WinForms Control.BeginInvoke asynchronous callback

I have a number of Janus grid controls that need to be populated on an application startup. I'd like to load these grids on different threads to speed startup time and the time it takes to refresh these grids. Each grid is on a seperate tab. Ideally I'd like to use Control.BeginInvoke on each grid and on the grid load completing the t...

Error callback every time when trying to POST XML using jQuery in non-IE browsers

I am trying to communicate with Google's spell check service using jQuery. Google's service requires that you post XML and it will in turn return an XML response. In IE, the success callback gets hit every time, but in non-IE browsers (tested in Firefox and Chrome) the error callback is getting hit every time. The biggest difference is ...