Search Results

Search found 5259 results on 211 pages for 'interrupt handling'.

Page 60/211 | < Previous Page | 56 57 58 59 60 61 62 63 64 65 66 67  | Next Page >

  • Qt/C++ event loop exception handling

    - by Georg
    I am having an application heavily based on QT and on a lot of third party libs. THese happen to throw some exceptions in several cases. In a native Qt App this causes the application to abort or terminate. Often the main data model is still intact as I am keeping it in pure Qt with no external data. So I am thinking that I could also just recover by telling the user that there has occured an error in this an that process and he should save now or even decide to continue working on the main model. Currently the program jsut silently exits without even telling a story. Please help.

    Read the article

  • Handling Denormalized Schema with Eclipselink

    - by iamrohitbanga
    Hello All I have a denormalized table containing employee information. The fields are employee id, name and department name. The primary key is a composite one consisting of all three fields. An employee can belong to multiple departments. I want to read/write the objects in the table using the Eclipselink Dynamic Persistence API (which is infact a wrapper on top of JPA descriptors etc.). Example Data: 1 e1 dep1 2 e1 dep2 3 e2 dep1 4 e2 dep3 5 e3 dep1 5 e3 dep2 5 e3 dep3 A normal ReadAllQuery (select query) on the table returns a DynamicEntity corresponding to each row in the table. However I want to club all entities based on the emp id and return all the departments he belongs to as a list. I can merge the entities after retrieving them but if I can use some Eclipselink feature out of the box then it would be better. One way to do the read is the following: I create two dynamic types corresponding to employee: Having id,name as the primary key Having id, department as the primary key, I create a OneToManyMapping from the first type to the second one. Then when I query the first type it does return the departments to which employee belongs as a list of DynamicEntity of the second type. This satisfies the read scenario. Is there a better way of doing this? Is this inherently supported by Eclipselink or JPA? I cannot get the same dynamic type configuration working for the write scenario. This is because when I write the changes using the writeObject method of UnitOfWork, it generates insert queries which enter the following entries in the table id name department 102 emp_102 102 st 102 dep_102 102 dep_102 102 dep_102 instead of: id name department 102 emp_102 st 102 emp_102 dep_102 102 emp_102 dep_102 102 emp_102 dep_102 Is there any way I can get write to work with this schema using eclipselink? I want to avoid doing the heavy lifting of merging the rows for such a denormalized schema or generating each row before doing a write. Is there no clean way of doing this using Eclipselink or JPA? Thanks in Advance.

    Read the article

  • WP7 - Cancelling ContextMenu click event propagation

    - by Praetorian
    I'm having a problem when the Silverlight toolkit's ContextMenu is clicked while it is over a UIElement that has registered a Tap event GestureListener. The context menu click propagates to the underlying element and fires its tap event. For instance, say I have a ListBox and each ListBoxItem within it has registered both a ContextMenu and a Tap GestureListener. Assume that clicking context menu item2 is supposed to take you to Page1.xaml, while tapping on any of ListBox items themselves is supposed to take you to Page2.xaml. If I open the context menu on item1 in the ListBox, then context menu item2 is on top of ListBox item2. When I click on context menu item2 I get weird behavior where the app navigates to Page1.xaml and then immediately to Page2.xaml because the click event also triggered the Tap gesture for ListBox item2. I've verified in the debugger that it is always the context menu that receives the click event first. How do I cancel the context menu item click's routed event propagation so it doesn't reach ListBox item2? Thanks for your help!

    Read the article

  • ASP .NET Button event handlers do not fire on the first click, but on the second click after a PostB

    - by John
    Background: I am customizing an existing ASP .NET / C# application. It has it's own little "framework" and conventions for developers to follow when extending/customizing its functionality. I am currently extending some of it's administrative functionality, to which the framework provides a contract to enforce implementation of the GetAdministrationInterface() method, which returns System.Web.UI.Control. This method is called during the Page_Load() method of the page hosting the GUI interface. Problem: I have three buttons in my GUI, each of which have been assigned an Event Handler. My administration GUI loads up perfectly fine, but clicking any of the buttons doesn't do what I expect them to do. However, when I click them a second time, the buttons work. I placed breakpoints at the beginning of each event handler method and stepped through my code. On the first click, none of the event handlers were triggered. On the second click, they fired. Any ideas? Example of Button Definition (within GetAdministrationInterface) public override Control GetAdministrationInterface() { // more code... Button btn = new Button(); btn.Text = "Click Me!"; btn.Click += new EventHandler(Btn_Click); // more code... } Example of Event Handler Method Definition void Btn_Click(object sender, EventArgs e) { // Do Something } Page_Load Method that calls GetAdministrationInterface protected void Page_Load(object sender, System.EventArgs e) { if (!Page.IsAsync) { List<AdministrationInterface> interfaces = <DATABASE CALL>; foreach(AdministrationInteface ai in interfaces) { placeholderDiv.Controls.Add(ai.GetAdministrationInterface()); } } }

    Read the article

  • Ruby xml rpc error handling

    - by stel
    I have a model class Car @@RPCServer = XMLRPC::Client.new("localhost", "/", 8080) def self.count @@RPCServer.call("cars.count") end end If server is not running on localhost:8080 I've got a Errno::ECONNREFUSED error. I want to display an error message to user, how can a handle this error?

    Read the article

  • Handling of data truncation (short reads/writes) in FUSE

    - by Vi
    I expect any good program should do all their reads and writes in a loop until all data written/read without relying that write will write everything (even with regular files). Am I right? Implemented simple FUSE filesystem which only allows reading and writing with small buffers, very often returning that it is written less bytes that in a buffer (using -o direct_io). Some programs work, some not (notably mountlo). Are them buggy or programs should not expect truncated writes and reads from the regular files? In general, are seekable file descriptors expected to truncate data like sockets and pipes?

    Read the article

  • C - What is the proper format to allow a function to show an error was encountered?

    - by BrainSteel
    I have a question about what a function should do if the arguments to said function don't line up quite right, through no fault of the function call. Since that sentence doesn't make much sense, I'll offer my current issue. To keep it simple, here is the most relevant and basic function I have. float getYValueAt(float x, PHYS_Line line, unsigned short* error) *error = 0; if(x < line.start.x || x > line.end.x){ *error = 1; return -1; } if(line.slope.value != 0){ //line's equation: y - line.start.y = line.slope.value(x - line.start.x) return line.slope.value * (x - line.start.x) + line.start.y; } else if(line.slope.denom == 0){ if(line.start.x == x) return line.start.y; else{ *error = 1; return -1; } } else if(line.slope.num == 0){ return line.start.y; } } The function attempts to find the point on a line, given a certain x value. However, under some circumstances, this may not be possible. For example, on the line x = 3, if 5 is passed as a value, we would have a problem. Another problem arises if the chosen x value is not within the interval the line is on. For this, I included the error pointer. Given this format, a function call could work as follows: void foo(PHYS_Line some_line){ unsigned short error = 0; float y = getYValueAt(5, some_line, &error); if(error) fooey(); else do_something_with_y(y); } My question pertains to the error. Note that the value returned is allowed to be negative. Returning -1 does not ensure that an error has occurred. I know that it is sometimes preferred to use the following method to track an error: float* getYValueAt(float x, PHYS_Line line); and then return NULL if an error occurs, but I believe this requires dynamic memory allocation, which seems even less sightly than the solution I was using. So, what is standard practice for an error occurring?

    Read the article

  • Which .NET exception to throw for invalid database state?

    - by jslatts
    I am writing some data access code and I want to check for potentially "invalid" data states in the database. For instance, I am returning a widget out of the database and I only expect one. If I get two, I want to throw an exception. Even though referential integrity should prevent this from occurring, I do not want to depend on the DBAs never changing the schema. I would like to use the System.IO.InvalidDataException, except that I am not dealing with a file stream so it would be misleading. I ended up going with a generic applicationexception. Anyone have a better idea?

    Read the article

  • How do I close a file after catching an IOException in java?

    - by DimDom
    All, I am trying to ensure that a file I have open with BufferedReader is closed when I catch an IOException, but it appears as if my BufferedReader object is out of scope in the catch block. public static ArrayList readFiletoArrayList(String fileName, ArrayList fileArrayList) { fileArrayList.removeAll(fileArrayList); try { //open the file for reading BufferedReader fileIn = new BufferedReader(new FileReader(fileName)); // add line by line to array list, until end of file is reached // when buffered reader returns null (todo). while(true){ fileArrayList.add(fileIn.readLine()); } }catch(IOException e){ fileArrayList.removeAll(fileArrayList); fileIn.close(); return fileArrayList; //returned empty. Dealt with in calling code. } } Netbeans complains that it "cannot find symbol fileIn" in the catch block, but I want to ensure that in the case of an IOException that the Reader gets closed. How can I do that without the ugliness of a second try/catch construct around the first? Any tips or pointers as to best practise in this situation is appreciated,

    Read the article

  • Exceptions over remote methods

    - by Andrei Vajna II
    What are the best practices for exceptions over remote methods? I'm sure that you need to handle all exceptions at the level of a remote method implementation, because you need to log it on the server side. But what should you do afterwards? Should you wrap the exception in a RemoteException (java) and throw it to the client? This would mean that the client would have to import all exceptions that could be thrown. Would it be better to throw a new custom exception with fewer details? Because the client won't need to know all the details of what went wrong. What should you log on the client? I've even heard of using return codes(for efficiency maybe?) to tell the caller about what happened. The important thing to keep in mind, is that the client must be informed of what went wrong. A generic answer of "Something failed" or no notification at all is unacceptable. And what about runtime (unchecked) exceptions?

    Read the article

  • Set reference = null in finally block?

    - by deamon
    A colleague of mine sets reference to null in finally blocks. I think this is nonsense. public Something getSomething() { JDBCConnection jdbc=null; try { jdbc=JDBCManager.getConnection(JDBCTypes.MYSQL); } finally { JDBCManager.free(jdbc); jdbc=null; // <-- Useful or not? } } What do you think of it?

    Read the article

  • iphone - how to properly handle exceptional situations (signals ?)

    - by pmilosev
    Hi In my iphone app, I want to provide some sort of app termination handler that will do some final work (delete some sensitive data) before the application terminates. I want to handle as much of the termination situations as possible: 1) User terminates the app 2) The device runs out of battery 3) The system terminates the app due to some reason (e.g. out of memory or app freeze) 4) Application crashes (EXC_BAD_ACCESS or SIGSEGV) Any other exceptional situation ? What is the best way to achieve this (e.g. is applicationWillTerminate method called in situation 2) ? Is it possible to do the cleanup in a signal handler (includes iPhone Security framework calls) ? regards

    Read the article

  • Handling very large lists of objects without paging?

    - by user246114
    Hi, I have a class which can contain many small elements in a list. Looks like: public class Farm { private ArrayList<Horse> mHorses; } just wondering what will happen if the mHorses array grew to something crazy like 15,000 elements. I'm assuming that trying to write and read this from the datastore would be crazy, because I'd get killed on the serialization process. It's important that I can get the entire array in one shot without paging, and each Horse element may only have two string properties in it, so they are pretty lightweight: public class Horse { private String mId; private String mName; } I don't need these horses indexed at all. Does it sound reasonable to just store the mHorse array as a raw Text field, and force my clients to do the deserialization? Something like: public class Farm { private Text mHorsesSerialized; } then whenever the client receives a Farm instance, it has to take the raw string of horses, and split it in order to reinstantiate the list, something like: // GWT client perhaps Farm farm = rpcCall.getMyFarm(); String horsesSerialized = farm.getHorses(); String[] horseBlocks = horsesSerialized.split(","); for (int i = 0; i < horseBlocks.length; i++) { // .. continue deserializing the individual objects ... } yeah... so hopefully it would be quick to read a Farm instance from the datastore, and the serialization penalty is paid by the client, Thanks

    Read the article

  • WPF Event Handler in Another Class

    - by Nathan Tornquist
    I have built a series of event handlers for some custom WPF controls. The event handles format the text displayed when the user enters or leaves a textbox based on the type of data contained (Phone number, zip code, monetary value, etc.) Right now I have all of the events locally in the C# code directly attached to the xaml. Because I have developed a could controls, this means that the logic is repeated a lot, and if I want to change the program-wide functionality I would have to make changes everywhere the event code is located. I am sure there is a way to put all of my event handlers in a single class. Can anyone help point me in the correct direction? I saw this article: Event Handler located in different class than MainWindow But I'm not sure if it directly relates to what I'm doing. I would rather make small changes to the existing logic that I have, as it works, then rewrite everything into commands. I would essentially like to something like this if possible: LostFocus="ExpandedTextBoxEvents.TextBox_LostFocus" It is easy enough to do something like this: private void TextBoxCurrencyGotFocus(object sender, RoutedEventArgs e) { ExpandedTextBoxEvents.TextBoxCurrencyGotFocus(sender, e); } private void TextBoxCurrencyLostFocus(object sender, RoutedEventArgs e) { ExpandedTextBoxEvents.TextBoxCurrencyLostFocus(sender, e); } But that is less elegant.

    Read the article

  • Exporting to CSV with dynamic field type handling

    - by serhio
    I have to do an export from DB to CSV. field; fileld; field... etc Have 3 types of fields: Alpha, Numeric and Bool respresented as "alphaValue",intValue and True/False. I try to encapsulate this in a fields collection, in order to export if alpha then set "", if Bool=True/False if numeric let as is. and try to build a CsvField class: Public Structure?Class CsvField(Of T As ???) End Structure Enum FieldType Alpha Bool Numeric End Enum any suggestions welcomed.

    Read the article

  • Handling static files with Django / lighttpd

    - by ptikobj
    I know that there is already a question (actually some more) about this, but the answers to them didn't help me out very much, as I am pretty new to lighttpd. I have one folder which contains .pdf-files. When doing a HttpResponseRedirect to the locations of one of those .pdf-files, the user should be able to download the .pdf file (or view it in the browser). Right now, Django just redirects to my "home" html page, without showing any pdf-file. Somehow, I will have to tell lighttpd that Django shouldn't handle this directory anymore. Is this the only thing I need to do? If yes, how should i do it?

    Read the article

  • Suppress "Done, but with errors on page" in IE

    - by calebthorne
    I have a website using lots of jQuery and JavaScript that produces a "Done, but with errors on page" message in the footer of IE. Everything on the site works perfectly, so I don't want to spend the time troubleshooting the exact error. All I would like to do is suppress the "Done, but with errors on page" message so that clients don't freak out. I tried the following at the top of the page with no success: window.onerror = function() {return true;}

    Read the article

  • Basic Python: Exception raising and local variable scope / binding

    - by SuperJdynamite
    I have a basic "best practices" Python question. I see that there are already StackOverflow answers tangentially related to this question but they're mired in complicated examples or involve multiple factors. Given this code: #!/usr/bin/python def test_function(): try: a = str(5) raise b = str(6) except: print b test_function() what is the best way to avoid the inevitable "UnboundLocalError: local variable 'b' referenced before assignment" that I'm going to get in the exception handler? Does python have an elegant way to handle this? If not, what about an inelegant way? In a complicated function I'd prefer to avoid testing the existence of every local variable before I, for example, printed debug information about them.

    Read the article

  • How to catch exceptions from processes in C#

    - by kitofr
    I all... I have an acceptance runner program here that looks something like this: public Result Run(CommandParser parser) { var result = new Result(); var watch = new Stopwatch(); watch.Start(); try { _testConsole.Start(); parser.ForEachInput(input => { _testConsole.StandardInput.WriteLine(input); return _testConsole.TotalProcessorTime.TotalSeconds < parser.TimeLimit; }); if (TimeLimitExceeded(parser.TimeLimit)) { watch.Stop(); _testConsole.Kill(); ReportThatTestTimedOut(result); } else { result.Status = GetProgramOutput() == parser.Expected ? ResultStatus.Passed : ResultStatus.Failed; watch.Stop(); } } catch (Exception) { result.Status = ResultStatus.Exception; } result.Elapsed = watch.Elapsed; return result; } the _testConsole is an Process adapter that wraps a regular .net process into something more workable. I do however have a hard time to catch any exceptions from the started process (i.e. the catch statement is pointless here) I'm using something like: _process = new Process { StartInfo = { FileName = pathToProcess, UseShellExecute = false, CreateNoWindow = true, RedirectStandardInput = true, RedirectStandardOutput = true, RedirectStandardError = true, Arguments = arguments } }; to set up the process. Any ideas?

    Read the article

  • LINQ to Entites: How should I handle System.InvalidOperationException when checking for existance of

    - by chris
    I have a many-to-one relationship that users can edit via checkboxes. PK of Foo is ID, and fid contains the id from the checkbox. I'm checking to see if an element exists with: Foo ent; try { ent = ctx.Foo.First(f => f.ID == fid); } catch (System.InvalidOperationException ioe) { ent = new Foo(); } It seems to me that I should be able to do this without throwing an exception. What would be the best way to do this?

    Read the article

  • C# Dynamic Keyword exception handling

    - by user972255
    The below code throws an exception when executing this line (i.e. something.Add(name)). I want to catch the actual exception when executing this. I mean I don't want to use catch(Exception ex) instead of that I want to know what is the correct exception thrown here. try { dynamic name= "test"; var something = new List<decimal>(); something.Add(name); } catch(Exception ex) { throw ex; } Thanks in advance.

    Read the article

  • Mapping the System.Exception with FaultException

    - by user357342
    I have used exception sheilding feature of application block, to map System.Exception with class that is marked as DataContract. It works very well. But When I have mapped the System.Exception with FaultException, I got the below error message. "An error has occurred while consuming this service. Please contact your administrator for more information. Error ID: fe2d28b5-8d26-430e-baf4-fe4b39da853c" Please let me know whether I can map the System.Exception with FaultException

    Read the article

  • Swing and handling threads

    - by James P.
    There's a couple questions here on StackOverflow on the subject of threading with the Swing api but things still aren't clear. What is the issue with the EDT, what is the proper way to initiate a Thread with Swing and in what cases should it be used? P.S: Any sources in terms of good practises would be appreciated.

    Read the article

  • .net exception pool

    - by javier
    I want to create a mecanism in a large .net application to handle all the exceptions in the application, and to save the error messages (in db or log file) so these errors can be fixed, and so we are aware of the problems in the application. Does anyone know a good way of creating a library to handle and process all the exceptions?. Are there any tools around that can simplify my task. What aproach would you suggest me to take.... If you previously implemented something similar to what I want to do, I do want to heard from you Thanks all

    Read the article

< Previous Page | 56 57 58 59 60 61 62 63 64 65 66 67  | Next Page >