abort

Stopping product saving process in observer

有些话、适合烂在心里 提交于 2019-11-30 17:18:04
问题 I am currently developing a module working with the product edit in the backend. Its purpose is to retrieve categories the product belongs to and populate an attribute (the Brand attribute) with the list of selected categories. It is mandatory for the admin to select at least one category. My module works as expected except that I don't know how to stop the saving process if the admin hasn't selected any category while editing a product. Here is the workflow Administrator selects categories

Abort a thread which is running a long query

亡梦爱人 提交于 2019-11-30 09:14:34
问题 I have a thread which calls one of the methods, now this method executes a query which can take a very long time possibly 40 minutes or so to complete, I want to give user a a choice to be able to cancel this operation (meaning stop the thread and stop the query to release database). I should mention that I am developing WPF Application using .net 4.5, SQL SERVER DB and C#. 回答1: You should use backgroundworker, it is exactly what you want. Eather drag and drop it from the toolbox or create it

How to check if connection was aborted in node.js server

只愿长相守 提交于 2019-11-30 04:40:21
I'm making some long polling with node.js. Basically, node.js server accepts request from the user and then checks for some updates. If there're no updates, it will check them after the timeout. But what if user has closed his tab, or went to another page? In my case, the script continues working. Is there a way in node.js to check or detect or to catch an event when user has aborted his request (closed the connection)? You need to use req.on('close', function(err) { ... }); instead of req.connection.on('close', function(err) { ... }); There is a very important distinction. req.on() adds a

Abort JSONP ajax request with jQuery

我的未来我决定 提交于 2019-11-30 03:28:36
I'm using a JSONP ajax call to load some content from a different domain, and all this stuff is executed if the user causes a "mouseover" on a button. I can capture the $.ajax() call return as a xhr object, and use it to abort the ajax request each time the user causes a "mouseover". But the JSONP callback function still gets called, and this causes an error, and I think it is beacuse the xhr.abort() method does not prevent the callback function to be called. I've tried surrounding the $.ajax() call with try{}catch(e){}, but after I call the xhr.abort() method, the error continues. Is there a

How do you cleanly abort a Delphi program?

人盡茶涼 提交于 2019-11-30 02:19:49
I've got a program that's having some trouble during shutdown, raising exceptions that I can't trace back to their source. It appears to be timing-related and non-deterministic. This is occurring after all shared resources have been released, and since it's shutdown, memory leaks are not an issue, so that makes me wonder if there's any way to just tell the program to terminate immediately and silently after releasing the shared resources, instead of continuing with the shutdown sequence and giving an exception message box. Does anyone know how to do that? After looking at the Delphi Run Time

Abort trap: 6 in C Program

喜你入骨 提交于 2019-11-29 14:46:12
I have a program in C. It compiles successfully and runs works fine but right at the end of main() , it crashes and gives me an Abort trap: 6 error. I haven't the slightest clue as to how I can debug this. The few questions on SO having to do with Abort trap: 6 errors have not been of much help to me. In general, what could be the problem? (I am reluctant to post my source code for now since it is around 400 lines of code. I would post a particular chunk of code if I knew what to look for.) Note: I am running the program in Terminal using GCC . But when I run it in XCode, my program crashes

Abort a thread which is running a long query

元气小坏坏 提交于 2019-11-29 14:27:34
I have a thread which calls one of the methods, now this method executes a query which can take a very long time possibly 40 minutes or so to complete, I want to give user a a choice to be able to cancel this operation (meaning stop the thread and stop the query to release database). I should mention that I am developing WPF Application using .net 4.5, SQL SERVER DB and C#. CularBytes You should use backgroundworker , it is exactly what you want. Eather drag and drop it from the toolbox or create it in code - behind. It supports Cancellation, reports progress, notifies when complete and know

Stuck on GenerateConsoleCtrlEvent in C# with console apps

怎甘沉沦 提交于 2019-11-29 08:25:20
I'm having the hardest time trying to get this to work, hoping one of you has done this before. I have a C# console app that is running a child process which inherits its console. I want a ctrl-c caught by the outer app to be passed along to the inner app so that it can have a chance to shut down nicely. I have some very simple code. I start a Process, then poll it with WaitForExit(10). I also have a CancelKeyPress handler registered, which sets a bool to true when it fires. The polling loop also checks this, and when it's true, it calls GenerateConsoleCtrlEvent() (which I have mapped through

Response.Redirect results in “Object moved to here”

百般思念 提交于 2019-11-29 02:50:11
I'm working on a C# ASP.NET page that normally ends up redirecting to a "file:" URL. This seems to work fine the majority of the time, in the majority of circumstances, but occasionally (and, on my test system, apparently always) instead of a redirect to a file I get a page with the text "Object moved to here", where "here" is a link to the file that I was trying to redirect to, but with four slashes after the colon instead of two (i.e. "file:////testserver/docs/testdoc.doc") This is normally accompanied by a "System.Threading.ThreadAbortException: Thread was being aborted" message. I've

How to check if connection was aborted in node.js server

与世无争的帅哥 提交于 2019-11-29 02:00:40
问题 I'm making some long polling with node.js. Basically, node.js server accepts request from the user and then checks for some updates. If there're no updates, it will check them after the timeout. But what if user has closed his tab, or went to another page? In my case, the script continues working. Is there a way in node.js to check or detect or to catch an event when user has aborted his request (closed the connection)? 回答1: You need to use req.on('close', function(err) { ... }); instead of