abort

Android stop download

天大地大妈咪最大 提交于 2019-12-08 12:46:15
问题 In my application I download and parse a html page. However, I want to be able to stop the download in its tracks (i.e. when the user hits cancel). This is the code I use now, which is being called from doInBackground from ASyncTask. How do I cancel this request from outside of the ASyncTask? I currently use htmlcleaner HtmlCleaner cleaner = new HtmlCleaner(); CleanerProperties props = cleaner.getProperties(); props.setAllowHtmlInsideAttributes(true); props.setAllowMultiWordAttributes(true);

Abort when passing Python CTypes struct containing array of 3 ints

為{幸葍}努か 提交于 2019-12-08 06:08:59
问题 I'm running Python 3.4.0-0ubuntu2 on Kubuntu Trusty 64 bit. When trying to find a minimal example for my other related (but not duplicate) question, I found that the following apparently trivial code using Python CTypes causes a SIGABRT upon the call to fn1 . (Note that in the other case, fn1 worked fine and it was only fn2 which didn't work and the signal was SIGSEGV there.) lib.c: #include <stdio.h> typedef struct { int data[3]; } Triplet; void fn1(Triplet t) { fprintf(stderr, "%d, %d, %d\n

Windows Phone 8 Geolocator can't set desiredAccuracy = High AND tie into PositionChanged event

…衆ロ難τιáo~ 提交于 2019-12-08 03:10:00
问题 background: I'm well versed in WPF/XAML, but new to Windows Phone 8. Hopefully there is just something stupid that I'm missing... I want DesiredAccuracy to be high, but I also want to hook into the PositionChanged event. When the below code reaches _GeoLocator.DesiredAccuracy = PositionAccuracy.High; it throws an abort. If it off, everything works but I really want high accuracy. It seems the two are mutually exclusive of one another. Error message is: Operation aborted (Exception from

How to catch an exception thrown in ctypes?

自古美人都是妖i 提交于 2019-12-08 02:50:15
问题 I am working with some C code called from Python using ctypes. Somewhere in the bowels of the C library, an exception is occurring and/or abort() is being called. Is there any way I can catch this in my Python caller code? (Platform is Linux) 回答1: You might be able to setup a signal handler on SIGABRT to handle the signal caused by abort(). However, failed assertions might go along with corrupted memory and other bad things - there's usually a reason why an assertion failed. So usually

Abort when passing Python CTypes struct containing array of 3 ints

扶醉桌前 提交于 2019-12-06 15:19:23
I'm running Python 3.4.0-0ubuntu2 on Kubuntu Trusty 64 bit. When trying to find a minimal example for my other related (but not duplicate) question , I found that the following apparently trivial code using Python CTypes causes a SIGABRT upon the call to fn1 . (Note that in the other case, fn1 worked fine and it was only fn2 which didn't work and the signal was SIGSEGV there.) lib.c: #include <stdio.h> typedef struct { int data[3]; } Triplet; void fn1(Triplet t) { fprintf(stderr, "%d, %d, %d\n", t.data[0], t.data[1], t.data[2]); } Triplet fn2(Triplet t) { Triplet temp = {{t.data[0] + 1, t.data

Using Abort to improve/simplify code in some situations

佐手、 提交于 2019-12-06 05:02:47
问题 I had a discussion the other day: https://stackoverflow.com/a/42156860/937125 where I didn't quite understand why an Abort was better than calling Exit in that situation. I tend not to use it in my code flow. I consider it a bad practice and bad for code flow. but @David's statement in the comments made me wonder if maybe I was missing something: Without a silent exception, how would you abort an operation when deep down the call stack. For instance how would you abort a file copy operation

C# Threads.Abort()

梦想的初衷 提交于 2019-12-06 01:37:25
问题 If a thread is running a function func1 that calls another function func2 inside it... Then I called thread.Abort() Will this stop func1 only OR func1 and func2 and all the functions func1 has called?? Thanks Edit: Here are more detail: func1 is called in a new thread, it continuously calls func2 on regular basis... func2 begin doing some work only if some array is not null.. it finishes it and return When supervisor wants to save data, it aborts Thread of func1 - and then makes array null,

Declaration of void abort() throws different exceptions

こ雲淡風輕ζ 提交于 2019-12-05 20:34:53
I am trying to write some C++ code (using the C++ API) for Festival and am getting stuck while trying to compile. Here is how I invoke g++ : g++ -Wall -pedantic -I../ -I../speech_tools/include/ helloFestival.C -o h -L../festival/src/lib/libFestival.a -L../speech_tools/lib/libestools.a -L../speech_tools/lib/libestbase.a -L../speech_tools/lib/libeststrings.a |& tee festival.runLog The error I get is: In file included from ../speech_tools/include/EST.h:48, from ../festival/src/include/festival.h:47, from helloFestival.C:4: ../speech_tools/include/EST_String.h:50: error: declaration of ‘void abort

MessageBox “Abnormal program termination” keeps my application running

陌路散爱 提交于 2019-12-05 06:48:13
...kind of. As illustrated by this extremely simplistic example, very rarely (only once reported so far), it happens that one of my applications crashes this way. I want to terminate it as I normally do when an unspecific exception occurs. My strategy is to (low-level) log the problem, then terminate. The application is part of a subsystem and I want to (re)start it, if any problem is detected. It's built with C++-Builder 6 and runs on Windows (XP...7, also 8). I learned that an abort() most probably caused the error message. The application has a GUI, that's why a message box is shown instead

Gracefully exit with MPI

血红的双手。 提交于 2019-12-05 05:34:10
问题 I'm trying to gracefully exit my program after if Rdinput returns an error. #include <mpi.h> #include <stdio.h> #include <stdlib.h> #define MASTER 0 #define Abort(x) MPI_Abort(MPI_COMM_WORLD, x) #define Bcast(send_data, count, type) MPI_Bcast(send_data, count, type, MASTER, GROUP) //root --> MASTER #define Finalize() MPI_Finalize() int main(int argc, char **argv){ //Code if( rank == MASTER ) { time (&start); printf("Initialized at %s\n", ctime (&start) ); //Read file error = RdInput(); }