Search Results

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

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

  • determine from where the function being called in php

    - by Avinash
    I have one function on my code. say its xyz(). This function is being called from different files of my project. Is there any way than I can get from where the function is being called. I want below infromation: File name from where its called. Line number of that file. if call is from inside the function then that function name. Class name Class method name. I know about use of magic constants like FILE and all that. but i don't want to pass all that in function call. like below: xyz('msg',__FILE__,__CLASS__); is there any way that i have to pass just my error related data only. and it will find the above details from where the function is called. let me know if anything is not clear.

    Read the article

  • task strategies for handling HardDeadlineExceededError

    - by Stevko
    I've got a number of tasks/servlets that are hitting the HardDeadlineExceededError which is leaving everything hanging in an 'still executing' state. The work being done can easily exceed the 29 second threshold. I try to catch the DeadlineExceededException and base Exception in order to save the exit state but neither of these exception handlers are being caught... Is there a way to determine which tasks are in the queue or currently executing? Are there any other strategies for dealing with this situation?

    Read the article

  • Python - from file to data structure?

    - by Seafoid
    Hi, I have large file comprising ~100,000 lines. Each line corresponds to a cluster and each entry within each line is a reference i.d. for another file (protein structure in this case), e.g. 1hgn 1dju 3nmj 8kfn 9opu 7gfb 4bui I need to read in the file as a list of lists where each line is a sublist, thus preserving the integrity of the cluster, e.g. nested_list = [['1hgn', '1dju', '3nmj', '8kfn'], ['9opu', '7gfb'], ['4bui']] My current code creates a nested list but the entries within each list are a single string and not comma separated. Therefore, I cannot splice the list with indices so easily. Any help greatly appreciated. Thanks, S :-)

    Read the article

  • C++ Storing variables and inheritance

    - by Kaa
    Hello Everyone, Here is my situation: I have an event driven system, where all my handlers are derived from IHandler class, and implement an onEvent(const Event &event) method. Now, Event is a base class for all events and contains only the enumerated event type. All actual events are derived from it, including the EventKey event, which has 2 fields: (uchar) keyCode and (bool)isDown. Here's the interesting part: I generate an EventKey event using the following syntax: Event evt = EventKey(15, true); and I ship it to the handlers: EventDispatch::sendEvent(evt); // void EventDispatch::sendEvent(const Event &event); (EventDispatch contains a linked list of IHandlers and calls their onEvent(const Event &event) method with the parameter containing the sent event. Now the actual question: Say I want my handlers to poll the events in a queue of type Event, how do I do that? x Dynamic pointers with reference counting sound like too big of a solution. x Making copies is more difficult than it sounds, since I'm only receiving a reference to a base type, therefore each time I would need to check the type of event, upcast to EventKey and then make a copy to store in a queue. Sounds like the only solution - but is unpleasant since I would need to know every single type of event and would have to check that for every event received - sounds like a bad plan. x I could allocate the events dynamically and then send around pointers to those events, enqueue them in the array if wanted - but other than having reference counting - how would I be able to keep track of that memory? Do you know any way to implement a very light reference counter that wouldn't interfere with the user? What do you think would be a good solution to this design? I thank everyone in advance for your time. Sincerely, Kaa

    Read the article

  • Clearing Session in Global Application_Error

    - by Zarigani
    Whenever an unhandled exception occurs on our site, I want to: Send a notification email Clear the user's session Send the user to a error page ("Sorry, a problem occurred...") The first and last I've had working for a long time but the second is causing me some issues. My Global.asax.vb includes: Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) ' Send exception report Dim ex As System.Exception = Nothing If HttpContext.Current IsNot Nothing AndAlso HttpContext.Current.Server IsNot Nothing Then ex = HttpContext.Current.Server.GetLastError End If Dim eh As New ErrorHandling(ex) eh.SendError() ' Clear session If HttpContext.Current IsNot Nothing AndAlso HttpContext.Current.Session IsNot Nothing Then HttpContext.Current.Session.Clear() End If ' User will now be sent to the 500 error page (by the CustomError setting in web.config) End Sub When I run a debug, I can see the session being cleared, but then on the next page the session is back again! I eventually found a reference that suggests that changes to session will not be saved unless Server.ClearError is called. Unfortunately, if I add this (just below the line that sets "ex") then the CustomErrors redirect doesn't seem to kick in and I'm left with a blank page? Is there a way around this?

    Read the article

  • Socket select() Handling Abrupt Disconnections

    - by Genesis
    I am currently trying to fix a bug in a proxy server I have written relating to the socket select() call. I am using the Poco C++ libraries (using SocketReactor) and the issue is actually in the Poco code which may be a bug but I have yet to receive any confirmation of this from them. What is happening is whenever a connection abruptly terminates the socket select() call is returning immediately which is what I believe it is meant to do? Anyway, it returns all of the disconnected sockets within the readable set of file descriptors but the problem is that an exception "Socket is not connected" is thrown when Poco tries to fire the onReadable event handler which is where I would be putting the code to deal with this. Given that the exception is silently caught and the onReadable event is never fired, the select() call keeps returning immediately resulting in an infinite loop in the SocketReactor. I was considering modifying the Poco code so that rather than catching the exception silently it fires a new event called onDisconnected or something like that so that a cleanup can be performed. My question is, are there any elegant ways of determining whether a socket has closed abnormally using select() calls? I was thinking of using the exception message to determine when this has occured but this seems dirty to me.

    Read the article

  • What's a good way to throw and handle events in PHP?

    - by techexpert
    Hi everyone, I am just trying to get a general idea about the event prcessing mechanism in PHP5 in as neat way as possible. First of all I understand that a PHP application is not exactly a persistent type, so the events may not make a lot of sense, but from the OO perspective it might be a very elegant way to "communicate" between the objects. So I am thinking that it would make sense to separate the events on the external events, such as $_POST & $_GET and the internal ones, i.e. function callbacks. As far as the external ones, is it a good idea to process the $_GETs and $_POSTs directly, or is it better to wrap them into an event of some sort? Also, in order to process the internal events, do you have to pass the reference to the event handler/dispatcher to each class so they know how to throw them? I was thinking to use the PEAR EventDispatcher to do the work, but I am open to other suggestions. Thank you!

    Read the article

  • How do I indicate that a class doesn't support certain operators?

    - by romeovs
    I'm writing a class that represents an ordinal scale, but has no logical zero-point (eg time). This scale should permit addition and substraction (operator+, operator+=, ...) but not multiplication. Yet, I always felt it to be a good practice that when one overloads one operator of a certain group (in this case the math operators), one should also overload all the others that belong to that group. In this case that would mean I should need to overload the multiplication and division operators also, because if a user can use A+B he would probable expect to be able the other operators. Is there a method that I can use to throw an error for this at compiler time? The easiest method would be just no to overload the operators operator*, ... yet it would seem appropriate to add a bit more explaination than operator* is not know for class "time". Or is this something that I really should not care about (RTFM user)?

    Read the article

  • Handling Timeouts In A Website SQLCommand Object and c#

    - by user341684
    I'm using visual studio 2008 and sql server 2005 and everything is working just fine under normal use. However if a user is on a page for a while several minutes with no activity then clicks a button on occassion the site throws the following exception ... Procedure or Function "sp_name" parameter '@SomeParameterName', which was not supplied I'm also encountering this error in Visual Studio while debugging the application, in otherwords run the site from visual studio then make some change to the html in VS save the changes and refresh the page. The error is not consistent nor is the time the page has to stay idle in order for it to occur.... The current sql command object timeout is 30 secs and the website timeout is 30 minutes. Has anyone else experienced this scenario and what is the fix as I would not except anything to go out of scope until the website timeout occurs ... Any insight will be appreciated.

    Read the article

  • Is there any real world reason to use throw ex?

    - by Michael Stum
    In C#, throw ex is almost always wrong, as it resets the stack trace. I just wonder, is there any real world use for this? The only reason I can think of is to hide internals of your closed library, but that's a really weak reason. Apart from that, I've never encountered in the real world. Edit: I do mean throw ex, as in throwing the exact same exception that was caught but with an empty stacktrace, as in doing it exactly wrong. I know that throw ex has to exist as a language construct to allow throwing a different exception (throw new DifferentException("ex as innerException", ex)) and was just wondering if there is ever a situration where a throw ex is not wrong.

    Read the article

  • Consuming services that consume other services.

    - by phthomas
    What is the best way to confirm that these consumed services are actually up and running before I actually try to invoke its operation contracts? I want to do this so that I can gracefully display some message to the customer to give him/her a more pleasant user experience. Thanks.

    Read the article

  • handling broadcast reciver

    - by rayman
    Hi, I have an app which has MainActivity(without gui.. please just flow with it:) ) now this MainActivity running a service, this service using sendBroadcast() in order to comunnicate with the MainActivity.. now ofcourse i need to registerReceiver in the onResume() of the MainActivity. but i also need to add unregisterReceiver(receiver) in the onDestroy() of the MainActivity. problem is: when i first start that app i need it to up the service, and i dont want the user to lose focus, so i press finish() after i`am starting the service.. but then auto invoked also unregisterReceiver(receiver).. and this is not good for me.. i get error it's said it couldnt find any registerd reciver. so i fixed it by delete this line.. but i am sure its going to 'revenege' me in the future, when/where could i have problem if i wont use unregisterReceiver(receiver).. at the onDestroy() thanks, ray.

    Read the article

  • I've caught an exception!! Now what?

    - by Jonesy
    Hi folks, I've started using try catch blocks (bit late i know!) but now im not sure what to do with the exception once i've caught it. What do people usually do here? -- Jonesy Try connection.Open() Dim sqlCmd As New SqlCommand("do some SQL", connection) Dim sqlDa As New SqlDataAdapter(sqlCmd) sqlDa.Fill(dt) Catch ex As SQLException ' ahhhh what to do now!!!? Finally connection.Close() End Try

    Read the article

  • Exception handling in WebForms

    - by user999379
    I have a webform with a formview <asp:FormView ID="formViewBrouwers" runat="server" AllowPaging="True" DataKeyNames="BrouwerNr" DataSourceID="brouwerDataSource" onitemupdated="formViewBrouwers_ItemUpdated" onitemupdating="formViewBrouwers_ItemUpdating" oniteminserted="formViewBrouwers_ItemInserted" oniteminserting="formViewBrouwers_ItemInserting"> <EditItemTemplate> BrouwerNr: <asp:Label ID="BrouwerNrLabel1" runat="server" Text='<%# Eval("BrouwerNr") %>' /> <br /> BrNaam: <asp:TextBox ID="BrNaamTextBox" runat="server" Text='<%# Bind("BrNaam") %>' /> <br /> Adres: <asp:TextBox ID="AdresTextBox" runat="server" Text='<%# Bind("Adres") %>' /> <br /> Postcode: <asp:TextBox ID="PostcodeTextBox" runat="server" Text='<%# Bind("Postcode") %>' /> <br /> Gemeente: <asp:TextBox ID="GemeenteTextBox" runat="server" Text='<%# Bind("Gemeente") %>' /> <br /> Omzet: <asp:TextBox ID="OmzetTextBox" runat="server" Text='<%# Bind("Omzet") %>' /> <br /> Status: <asp:TextBox ID="StatusTextBox" runat="server" Text='<%# Bind("Status") %>' /> <br /> <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" /> &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /> </EditItemTemplate> <InsertItemTemplate> BrNaam: <asp:TextBox ID="BrNaamTextBox" runat="server" Text='<%# Bind("BrNaam") %>' /> <br /> Adres: <asp:TextBox ID="AdresTextBox" runat="server" Text='<%# Bind("Adres") %>' /> <br /> Postcode: <asp:TextBox ID="PostcodeTextBox" runat="server" Text='<%# Bind("Postcode") %>' /> <br /> Gemeente: <asp:TextBox ID="GemeenteTextBox" runat="server" Text='<%# Bind("Gemeente") %>' /> <br /> Omzet: <asp:TextBox ID="OmzetTextBox" runat="server" Text='<%# Bind("Omzet") %>' /> <br /> Status: <asp:TextBox ID="StatusTextBox" runat="server" Text='<%# Bind("Status") %>' /> <br /> <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" /> &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /> </InsertItemTemplate> <ItemTemplate> BrouwerNr: <asp:Label ID="BrouwerNrLabel" runat="server" Text='<%# Eval("BrouwerNr") %>' /> <br /> BrNaam: <asp:Label ID="BrNaamLabel" runat="server" Text='<%# Bind("BrNaam") %>' /> <br /> Adres: <asp:Label ID="AdresLabel" runat="server" Text='<%# Bind("Adres") %>' /> <br /> Postcode: <asp:Label ID="PostcodeLabel" runat="server" Text='<%# Bind("Postcode") %>' /> <br /> Gemeente: <asp:Label ID="GemeenteLabel" runat="server" Text='<%# Bind("Gemeente") %>' /> <br /> Omzet: <asp:Label ID="OmzetLabel" runat="server" Text='<%# Bind("Omzet") %>' /> <br /> Status: <asp:Label ID="StatusLabel" runat="server" Text='<%# Bind("Status") %>' /> <br /> <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" /> &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete" /> &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New" Text="New" /> </ItemTemplate> <PagerSettings Mode="NextPreviousFirstLast" /> </asp:FormView> In my property Postcode I check the value like this: private Int16 postcodeValue; public Int16 Postcode { get { return postcodeValue; } set { if (value < 1000 || value > 9999) { throw new Exception("Postcode moet tussen 1000 en 9999 liggen"); } else { postcodeValue = value; } } } How can I handle the exception I threw? If there is an exception I want a label to appear with the following exception?

    Read the article

  • Can I raise System Error in sql Server in a stored procedure.

    - by Shantanu Gupta
    I am writing a stored procedure where i m using try catch block. Now i have a unique column in a table. When i try to insert duplicate value it throws exception with exception no 2627. I want this to be done like this if (exists(select * from tblABC where col1='value')=true) raiseError(2627)--raise system error that would have thrown if i would have used insert query to insert duplicate value And which method will be better, using insert query or checking for duplicate value before insertion using Select query ?

    Read the article

  • Common Utility for Exception Searching

    - by Andrew
    I wrote this little helper method to search the exception chain for a particular exception (either equals or super class). However, this seems like a solution to a common problem, so was thinking it must already exist somewhere, possibly in a library I have already imported. So, any ideas on if/where this might exist? boolean exceptionSearch(Exception base, Class<?> search) { Throwable e = base; do { if (search.isAssignableFrom(e.getClass())) { return true; } } while ((e = e.getCause()) != null); return false; }

    Read the article

  • Redirect in Application_Error redundant if using customErrors?

    - by Ek0nomik
    If I have a customErrors section in my Web.config that says to redirect to Error.html, then putting code in the Application_Error method in the Global.asax to redirect to Error.html is redundant is it not? Technically, I could bypass the Web.config by redirecting to a different page in the Application_Error method if I wanted to, but since I don't want to go to a separate page I don't think I need the code.

    Read the article

  • How can I add an event handler to an event by name?

    - by cyclotis04
    I'm attempting to add an event handler for every control on my form. The form is a simple info box which pops up, and clicking anywhere on it does the same thing (sort of like Outlook's email notifier.) To do this, I've written a recursive method to add a MouseClick handler to each control, as follows: private void AddMouseClickHandler(Control control, MouseEventHandler handler) { control.MouseClick += handler; foreach (Control subControl in control.Controls) AddMouseClickHandler(subControl, handler); } However, if I wanted to add a handler for all of the MouseDown and MouseUp events, I'd have to write two more methods. I'm sure there's a way around this, but I can't find it. I want a method like: private void AddRecursiveHandler(Control control, Event event, EventHandler handler) { control.event += handler; foreach (Control subControl in control.Controls) AddRecursiveHandler(subControl, event, handler); }

    Read the article

  • Handling RSS Tags with NSXMLParser for iPhone

    - by MartinW
    I've found the following code for parsing through RSS but it does not seem to allow for nested elements: - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{ NSLog(@"ended element: %@", elementName); if ([elementName isEqualToString:@"item"]) { // save values to an item, then store that item into the array... [item setObject:currentTitle forKey:@"title"]; [item setObject:currentLink forKey:@"link"]; [item setObject:currentSummary forKey:@"summary"]; [item setObject:currentDate forKey:@"date"]; [item setObject:currentImage forKey:@"media:thumbnail"]; The RSS to used is: <item><title>Knife robberies and burglaries up</title> <description>The number of robberies carried out at knife-point has increased sharply and burglaries are also up, latest crime figures indicate</description> <link>http://news.bbc.co.uk/go/rss/-/1/hi/uk/7844455.stm</link> <guid isPermaLink="false">http://news.bbc.co.uk/1/hi/uk/7844455.stm</guid> <pubDate>Thu, 22 Jan 2009 13:02:03 GMT</pubDate><category>UK</category> <media:thumbnail width="66" height="49" url="http://newsimg.bbc.co.uk/media/images/45400000/jpg/_45400861_policegeneric_pa.jpg"/> </item> I need to extract the "url" element from the "media" tag. Thanks Martin

    Read the article

  • Asp.Net error reporting with stacktrace

    - by Helo
    I have an Asp.Net web site set up to log errors using Log4Net (in global.asax) and redirect users to a custom error page (set up in web.config with: ). On this error page the users have the opportunity to write about what they did when the error occurred and post the description back to us to help fix the problem. My question is this: How do i connect the error stacktrace to the users error report? It appears that .Net has handled the error when it was written to the log file and the custom error page has no information about the stacktrace. If only I could see the stacktrace from the custom error page code-behind my problem would be solved.

    Read the article

  • Flex Drag & Drop: Detecting when all data has been moved from source to destination

    - by Adam Tuttle
    I have two mx:TileList controls that I'm using to allow editing of objects in batch. The first contains a collection of all available data, and the 2nd contains the current batch. Both are bound to ArrayCollections, and using the native drag-n-drop functionality of the TileList control the data is moved from one ArrayCollection to the other when an object is dragged between them. I need to change the currentState to show & reset the batch manipulation controls when the batch count goes from 0 to n or n to 0 items. Based on the documentation, I would have thought that I should listen to the dragComplete event, but my testing shows that instead of firing after the data has been removed from the source ArrayCollection and added to the destination ArrayCollection, it fires (consistently) between these two actions. Both lists are similar to this: <mx:TileList id="srcList" dragEnabled="true" dropEnabled="true" dragMoveEnabled="true" dataProvider="{images}" dragComplete="handleDragComplete(event)" allowMultipleSelection="true" /> And here's the source of the handleDragComplete function: private function handleDragComplete(e:DragEvent):void{ trace(e.dragInitiator.name + '.dragComplete: batch.length=' + batch.length.toString()); trace(e.dragInitiator.name + '.dragComplete: images.length=' + images.length.toString()); if (batch.length > 0){ currentState = 'show'; }else{ currentState = ''; } } And lastly, here's some example output from running the code. These are all run one after the other. Case 1: The application loads with 10 objects in the first list and the batch is empty. I dragged 1 object from the source list to the batch list. srcList.dragComplete: batch.length=1 srcList.dragComplete: images.length=10 (Expected: 1,9) Clearly, the object has been added to the batch ArrayCollection but not removed from the source. Case 2: Now, I'll drag a 2nd object into the batch. srcList.dragComplete: batch.length=2 srcList.dragComplete: images.length=9 (Expected: 2,8) Firstly, we can see that images.length has changed, showing that the object that I dragged from the source list to the batch list was removed AFTER the dragComplete event fired. The same thing happens this time: The new object is added to the batch ArrayCollection (batch.length=2), the dragComplete event fires (running these traces), and then the object is removed from the source ArrayCollection. Case 3: Now, I'll drag both images from the batch list back to their original location in the source list. batchList.dragComplete: batch.length=2 batchList.dragComplete: images.length=10 (Expected: 0,10) We can see that batch.length hasn't gone down, but the source images array is back at its original length of 10. QUESTION: Am I doing something wrong? Is there another event I could listen for? (Note: I tried both DragExit and DragDrop, just to be sure, and those behave as expected, but are not what I need.) Or is there another way to get the data that I want? Or... have I found a bug in the SDK?

    Read the article

  • Handling Apache Thrift list/map Return Types in C++

    - by initzero
    First off, I'll say I'm not the most competent C++ programmer, but I'm learning, and enjoying the power of Thrift. I've implemented a Thrift Service with some basic functions that return void, i32, and list. I'm using a Python client controlled by a Django web app to make RPC calls and it works pretty well. The generated code is pretty straight forward, except for list returns: namespace cpp Remote enum N_PROTO { N_TCP, N_UDP, N_ANY } service Rcon { i32 ping() i32 KillFlows() i32 RestartDispatch() i32 PrintActiveFlows() i32 PrintActiveListeners(1:i32 proto) list<string> ListAllFlows() } The generated signatures from Rcon.h: int32_t ping(); int32_t KillFlows(); int32_t RestartDispatch(); int32_t PrintActiveFlows(); int32_t PrintActiveListeners(const int32_t proto); int64_t ListenerBytesReceived(const int32_t id); void ListAllFlows(std::vector<std::string> & _return); As you see, the ListAllFlows() function generated takes a reference to a vector of strings. I guess I expect it to return a vector of strings as laid out in the .thrift description. I'm wondering if I am meant to provide the function a vector of strings to modify and then Thrift will handle returning it to my client despite the function returning void. I can find absolutely no resources or example usages of Thrift list< types in C++. Any guidance would be appreciated.

    Read the article

  • Handling JSON and HTML templates in jQuery

    - by Toby Hede
    I have an ajax-enabled site that presents a lot of dynamic content by interpolating JSON values with HTML. This all works fine. BUT it means I have significant amounts of HTML all through my JavaScript. For example: var template = "<div>Foo: {bar}</div><div>Blah: {vtha}</div>"; template.interpolate({bar:"bar",blah:"vtha"}); I have cut this down a fair bit - some of my dynamic elements have quite a lot of HTML and a lot going on. I am using jQuery and I am building on Rails, so if there is something smart in either framework, that would be great. For reference, the String interpolation function used above is: String.prototype.interpolate = function (o) { return this.replace(/{([^{}]*)}/g, function (a, b) { var r = o[b]; return typeof r === 'string' || typeof r === 'number' ? r : a; } ); };

    Read the article

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