Search Results

Search found 5843 results on 234 pages for 'material handling equipme'.

Page 9/234 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Difference between Resume and Goto in error handling block

    - by Rich Oliver
    I understand that in the following example a Resume statement should be used instead of a Goto statement. Sub Method() On Error Goto ErrorHandler ... CleanUp: ... Exit Function ErrorHandler: Log error etc Err.Clear 'Is this line actually necessary?' Resume CleanUp 'SHOULD USE THIS' Goto CleanUp 'SHOULD NOT USE THIS' End Sub My question is what difference is there in the execution of the two?

    Read the article

  • How do you access the Source Error, Source File and Line Number of an exception to use in a custom e

    - by Iain Fraser
    Basically I want to take the following: And make it match the styling of the rest of the application. I am creating a custom error page in my C# based project and I want it to be able to show the same information that is displayed in the ASP.NET default error page. From fiddling with reflector I can see that this is generated through HttpException.GetHtmlErrorMessage() but when I try to use this in my exception it returns null.

    Read the article

  • MySQLi error handling

    - by Spoonface
    Is it possible to specify that MySQLi sends any errors and warnings to the PHP default 'error_log' directive? I can't seem to find any error options for the class specification, and I don't wish to handle errors manually like so: if ($result = $mysqli->query("...")) { } else handle $mysqli->error;

    Read the article

  • Multiple Exception Handling in one if statement [closed]

    - by JA3N
    I am having trouble with throwing and catching exceptions. Here is the code for assignSeat(), assignSeat is called in a try block in another class. void assignSeat(String passengerName, int x, int y) throws SeatOccupiedException, InvalidPassengerNameException { Seat tSeat = airplane.getSeat(x,y); if (tSeat!=null) { if (passengerName.isEmpty() || !passengerName.matches("[a-zA-Z]+")) { throw new InvalidPassengerNameException(); } //excluded else if else if (foundPassenger(passengerName)) { airplane.seatList.get(airplane.seatNumber(passengerName)).unOccupy(); tSeat.occupy(); for (int i = 0; i<passengers.size();i++) if (passengers.get(i).getName().equals(passengerName)) passengers.get(i).changeSeat(tSeat.getSeatName()); } else if (!tSeat.occupied) { tSeat.occupy(); addPassenger(passengerName, tSeat.getSeatName()); } else if (tSeat.occupied) { throw new SeatOccupiedException(); } } and here is the code that calls assignSeat() and is in another class (I won't copy the whole class to make it look clearer) if (afComp.currentAF != null) { try { afComp.currentAF.assignSeat(nameField.getText(), x, y); //<-Problem here, "Unhandled exception type SeatOccupiedException" } catch (SeatOccupiedException exception) //<-Problem here, "Unreachable catch block, This exception is never thrown from the try statement body" { } catch(InvalidPassengerNameException exception) //<-No problems. { } } Whats wrong with the try block? why won't it throw the SeatOccupiedException? Exception classes: SeatOccupied: package a2; public class SeatOccupiedException extends Exception { public SeatOccupiedException(){} } InvalidPassengerName: package a2; public class InvalidPassengerNameException extends Exception { public InvalidPassengerNameException() {} } Every class I have is in package a2 imports for class that calls assignSeat package a2; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.event.MouseEvent; import java.awt.BorderLayout; import javax.swing.*; import javax.swing.event.*; imports for class that has assignSeat package a2; import java.util.ArrayList;

    Read the article

  • Handling scroll event on listview in c#

    - by murasaki5
    I have a listview that generates thumbnail using a backgroundworker. When the listview is being scrolled i want to pause the backgroundworker and get the current value of the scrolled area, when the user stopped scrolling the listview, resume the backgroundworker starting from the item according to the value of the scrolled area. Is it possible to handle scroll event of a listview? if yes how? if not then what is a good alternative according to what i described above?

    Read the article

  • Handling user input in C

    - by Stuart
    In C, I am writing a program which is taking in user input than comparing it to see which output it should use. I am finding it problomatic and was wondering if someone could give me a hand. So far I have: while(cmd[0] != EOF){ fgets(cmd, sizeof(cmd), stdin); /** Takes in user input and stores it in cmd **/ if(cmd[0] == '\n') printf("%s> ", cwd); else if(strcmp(cmd, "ls") == 0) printf("I will list everything"); } Any ideas? Basically it is just ignoring any user input when there is some. P.S. The variable cwd is just a string.

    Read the article

  • How to handle window closed in the middle of a long running operation gracefully?

    - by Marek
    We have the following method called directly from the UI thread: void DoLengthyProcessing() { DoStuff(); var items = DoMoreStuff(); //do even more stuff - 200 lines of code trimmed this.someControl.PrepareForBigThing(); //someControl is a big user control //additional 100 lines of code that access this.someControl this.someControl.Finish(items); } Many of the called methods call Application.DoEvents() (and they do so many times) (do not ask me why, this is black magic written by black magic programmers and it can not be changed because everyone is scared what the impact would be) and there is also an operation running on a background thread involved in the processing. As a result, the window is not fully nonresponsive and can be closed manually during the processing. The Dispose method of the form "releases" the someControl variable by setting it to null. As a result, in case the user closes the window during the lengthy process, a null reference exception is thrown. How to handle this gracefully without just catching and logging the exception caused by disposal? Assigning the someControl instance to a temporary variable in the beginning of the method - but the control contains many subcontrols with similar disposal scheme - sets them to null and this causes null reference exceptions in other place put if (this.IsDisposed) return; calls before every access of the someControl variable. - making the already nasty long method even longer and unreadable. in Closing event, just indicate that we should close and only hide the window. Dispose it at the end of the lengthy operation. This is not very viable because there are many other methods involved (think 20K LOC for a single control) that would need to handle this mechanism as well. How to most effectively handle window disposal (by user action) in the middle of this kind of processing?

    Read the article

  • Appropriate use of die()?

    - by letseatfood
    I create pages in my current PHP project by using the following template: <?php include 'bootstrap.php'; head(); ?> <!-- Page content here --> <?php foot(); ?> Is the following example an appropriate use of die()? Also, what sort of problems might this cause for me, if any? <?php include 'bootstrap.php'; head(); try { //Simulate throwing an exception from some class throw new Exception('Something went wrong!'); } catch(Exception $e) { ?> <p>Please fix the following errors:</p> <p><?php echo $e->getMessage(); ?></p> <?php foot(); die(); } //If no exception is thrown above, continue script doSomething(); doSomeOtherThing(); foot(); ?> ?> <?php foot(); ?> Basically, I have a script with multiple tasks on it and I am trying to set up a graceful way to notify the user of input errors while preventing the remaining portion of the script from executing. Thanks!

    Read the article

  • Basic QT Event handling / Threading questions ?

    - by umanga
    Greetings , I am new to QT (4.6) and have some basic questions regarding its event mechanism.I come from Swing background so I am trying to compare it with QT. 1) Does Event-processing-loop run in seperate thread? (like EventDispatch thread in Swing) ? 2) If we open several 'QMainWindow' do they run in several threads? 3) Whats the best way to run an intensive process in a seperate thread? (like SwingWorker in Swing ? ) 4) If intesive-process runs in a seperate thread ,is it possible to call UI methods like update(),repaint() from that process? thanks in advance.

    Read the article

  • Best practice for error handling in codeigniter / php apps

    - by Industrial
    Hi everyone, We're working with a new codeigniter based application that are cross referencing different PHP functions forwards and backwards from various libraries, models and such. We're running PHP5 on the server and we try to find a good way for managing errors and status reports that arises from the usage of our functions. While using return in functions, the execution is ended, so nothing more can be sent back. Right? What's the best practice to send a status information or error code upon ending execution of actual function? Should we look into using exceptions or any other approach? http://us.php.net/manual/en/language.exceptions.php

    Read the article

  • Can Grails exceptionHandler support the following Error Handling Flow

    - by Andrew
    In my rails app that I am porting to grails whenever an unexpected error occurs I intercept the error automatically and display a form to the user informing them that an error has occured and asking them for further information. Meanwhile, as the form is rendered I write the stack trace and other information about who was logged in to a database table. Then if the form is submitted I add that information to the error report. I cannot tell from the exceptionHandler documentation and BootStrap examples whether that will allow me to grab all the information including various session and request parameters and then stuff them into a database and then post a form. Any thoughts?

    Read the article

  • Recommended approach for error handling with PHP and MYSQL

    - by iama
    I am trying to capture database (MYSQL) errors in my PHP web application. Currently, I see that there are functions like mysqli_error(), mysqli_errno() for capturing the last occurred error. However, this still requires me to check for error occurrence using repeated if/else statements in my php code. You may check my code below to see what I mean. Is there a better approach to doing this? (or) Should I write my own code to raise exceptions and catch them in one single place? What is the recommended approach? Also, does PDO raise exceptions? Thanks. function db_userexists($name, $pwd, &$dbErr) { $bUserExists = false; $uid = 0; $dbErr = ''; $db = new mysqli(SERVER, USER, PASSWORD, DB); if (!mysqli_connect_errno()) { $query = "select uid from user where uname = ? and pwd = ?"; $stmt = $db->prepare($query); if ($stmt) { if ($stmt->bind_param("ss", $name, $pwd)) { if ($stmt->bind_result($uid)) { if ($stmt->execute()) { if ($stmt->fetch()) { if ($uid) $bUserExists = true; } } } } if (!$bUserExists) $dbErr = $db->error(); $stmt->close(); } if (!$bUserExists) $dbErr = $db->error(); $db->close(); } else { $dbErr = mysqli_connect_error(); } return $bUserExists; }

    Read the article

  • WCF - Error Handling

    - by inutan
    Hello there, I have my WCF Service hosted in Windows Service. The client application is a website project to which I added the Service reference. I was not using any error logging/tracing... but now I feel I should implement as it will help me not to make void guesses. Please guide me for the best practice so that I can quickly handle errors and pin point the exact issue. Thank you!

    Read the article

  • Handling click events on z-index'd layers

    - by Alex
    I have 2 z-index layers in a map application I'm building. I have a problem when I click on the layers to zoom in. The click handler is on the underlying z-index layer and I don't want it to fire when a control in the overlying layer is clicked. The problem i have is that the event gets raised no matter what but the originalTarget property of the event is not the image in the underlying layer when something on the top layer is clicked. Is there anyway to change this?

    Read the article

  • Can somebody explain the difference between exceptions and errors (specific to PHP)?

    - by letseatfood
    I am having trouble figuring the best way to display errors to my clients. Should I use exceptions or errors? For example, if the user's login information does not match the database, should I throw new Exception('Login information is incorrect. Please try again.') and catch it with an exception handler using set_exception_handler()? Or, should I use trigger_error() to display an error message to the user? I think the main issue is that I cannot differentiate between errors and exceptions. I have read a lot of "answers" to this question on the internet and in some books, but it seems that people are really divided or aren't sure. Thanks!

    Read the article

  • javascript error handling

    - by pankaj
    I have a javascript function for checking errors which I am calling on OnClicentClick event of a button. Once it catch a error I want to stop execution of the click event. But in my case it always it always executes the onclick event. Following is my function: function DisplayError() { if (document.getElementById('<%=txtPassword.ClientID %>').value.length < 6 || document.getElementById('<%=txtPassword.ClientID %>').value.length > 12) { document.getElementById('<%=lblError.ClientID %>').innerText = "Password length must be between 6 to 12 characters"; return false; } var str = <%=PhoneNumber()%>; if(str.length <10) { alert('<%=phoneNum%>'.length); document.getElementById('<%=lblError.ClientID %>').innerText = "Phone Number not in correct format"; return false; } } button html code: <asp:Button runat="server" Text="Submit" ID="btnSubmit" ValidationGroup="submit" onclick="btnSubmit_Click" OnClientClick="DisplayError()"/> It should not execute the button click event once it satisfies any of the IF condition in the javascript function.

    Read the article

  • CMD Execption Handling C/C++

    - by ciyo
    I will use some CMD commands in my program and these commands might throw some exceptions. And as you know, when an exception accours, CMD writes its own error message the screen. But, I want to write my own error message. My question is this: Is there a way to block CMD messages and write only my own error messages? P.S. This is not a complex program. It executes CMD commands using System(). Example: Let's say, the user can rename and copy any files in the program. As you know, if the user does not enter file's path properly, an error message is showed on the screen. And I want that this error message never appears on the screen. Only my own error message is showed. Thank you!

    Read the article

  • Asp.Net MVC Error Handling & logging

    - by Navish Rampal
    I am trying to Catch exceptions and log it. Presently I have written a Utility method and Passing the Exception to it in the catch block and finally logging the application using MS Enterprise Library 4.0. I want to know is there any other better way to log errors. Show exception message in the same view for some type of exceptions for rest navigate to error page. If someone can help me on this! Navish

    Read the article

  • Subterranean IL: Exception handling 1

    - by Simon Cooper
    Today, I'll be starting a look at the Structured Exception Handling mechanism within the CLR. Exception handling is quite a complicated business, and, as a result, the rules governing exception handling clauses in IL are quite strict; you need to be careful when writing exception clauses in IL. Exception handlers Exception handlers are specified using a .try clause within a method definition. .try <TryStartLabel> to <TryEndLabel> <HandlerType> handler <HandlerStartLabel> to <HandlerEndLabel> As an example, a basic try/catch block would be specified like so: TryBlockStart: // ... leave.s CatchBlockEndTryBlockEnd:CatchBlockStart: // at the start of a catch block, the exception thrown is on the stack callvirt instance string [mscorlib]System.Object::ToString() call void [mscorlib]System.Console::WriteLine(string) leave.s CatchBlockEnd CatchBlockEnd: // method code continues... .try TryBlockStart to TryBlockEnd catch [mscorlib]System.Exception handler CatchBlockStart to CatchBlockEnd There are four different types of handler that can be specified: catch <TypeToken> This is the standard exception catch clause; you specify the object type that you want to catch (for example, [mscorlib]System.ArgumentException). Any object can be thrown as an exception, although Microsoft recommend that only classes derived from System.Exception are thrown as exceptions. filter <FilterLabel> A filter block allows you to provide custom logic to determine if a handler block should be run. This functionality is exposed in VB, but not in C#. finally A finally block executes when the try block exits, regardless of whether an exception was thrown or not. fault This is similar to a finally block, but a fault block executes only if an exception was thrown. This is not exposed in VB or C#. You can specify multiple catch or filter handling blocks in each .try, but fault and finally handlers must have their own .try clause. We'll look into why this is in later posts. Scoped exception handlers The .try syntax is quite tricky to use; it requires multiple labels, and you've got to be careful to keep separate the different exception handling sections. However, starting from .NET 2, IL allows you to use scope blocks to specify exception handlers instead. Using this syntax, the example above can be written like so: .try { // ... leave.s EndSEH}catch [mscorlib]System.Exception { callvirt instance string [mscorlib]System.Object::ToString() call void [mscorlib]System.Console::WriteLine(string) leave.s EndSEH}EndSEH:// method code continues... As you can see, this is much easier to write (and read!) than a stand-alone .try clause. Next time, I'll be looking at some of the restrictions imposed by SEH on control flow, and how the C# compiler generated exception handling clauses.

    Read the article

  • Improving exception handling ?

    - by n00b
    Hello, I am a newbie programmer and I recently started learning about exception handling in Java. I know what try, catch and finally blocks do, but I really need to understand how to use them well and where to handle something in the call stack... I have a project right now that involves I/O and all I'm doing is handling the exception in the lowest possible method in the call stack. I'm sure my exception handling can be improved, so I'm asking you guys how you think of exception handling? How did you guys get good at this and how can I better wrap my head around this idea?

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >