Search Results

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

Page 39/211 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • handling DATETIME values 0000-00-00 00:00:00 in JDBC

    - by Jason S
    I get an exception (see below) if I try to do resultset.getString("add_date"); for a JDBC connection to a MySQL database containing a DATETIME value of 0000-00-00 00:00:00 (the quasi-null value for DATETIME), even though I'm just trying to get the value as string, not as an object. I got around this by doing SELECT CAST(add_date AS CHAR) as add_date which works, but seems silly... is there a better way to do this? My point is that I just want the raw DATETIME string, so I can parse it myself as is. note: here's where the 0000 comes in: (from http://dev.mysql.com/doc/refman/5.0/en/datetime.html) Illegal DATETIME, DATE, or TIMESTAMP values are converted to the “zero” value of the appropriate type ('0000-00-00 00:00:00' or '0000-00-00'). The specific exception is this one: SQLException: Cannot convert value '0000-00-00 00:00:00' from column 5 to TIMESTAMP. SQLState: S1009 VendorError: 0 java.sql.SQLException: Cannot convert value '0000-00-00 00:00:00' from column 5 to TIMESTAMP. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926) at com.mysql.jdbc.ResultSetImpl.getTimestampFromString(ResultSetImpl.java:6343) at com.mysql.jdbc.ResultSetImpl.getStringInternal(ResultSetImpl.java:5670) at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5491) at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5531)

    Read the article

  • C# - Removing event handlers - FormClosing event or Dispose() method

    - by Andy
    Suppose I have a form opened via the .ShowDialog() method. At some point I attach some event handlers to some controls on the form. e.g. // Attach radio button event handlers. this.rbLevel1.Click += new EventHandler(this.RadioButton_CheckedChanged); this.rbLevel2.Click += new EventHandler(this.RadioButton_CheckedChanged); this.rbLevel3.Click += new EventHandler(this.RadioButton_CheckedChanged); When the form closes, I need to remove these handlers, right? At present, I am doing this when the FormClosing event is fired. e.g. private void Foo_FormClosing(object sender, FormClosingEventArgs e) { // Detach radio button event handlers. this.rbLevel1.Click -= new EventHandler(this.RadioButton_CheckedChanged); this.rbLevel2.Click -= new EventHandler(this.RadioButton_CheckedChanged); this.rbLevel3.Click -= new EventHandler(this.RadioButton_CheckedChanged); } However, I have seen some examples where handlers are removed in the Dispose() method. Is there a 'best-practice' way of doing this? (Using C#, Winforms, .NET 2.0) Thanks.

    Read the article

  • Java Exceptions

    - by Mandar
    This may sound awkward ... But I didn't understand it. Why do we have compile-time error and not compile-time exception in java ? I mean to say that we never say compile-time exception. We tend to say it as compile-time error. Is there any specific reason for the same ?? Any suggestions are welcomed.... Thanks !

    Read the article

  • How to properly close a socket after an exception is caught?

    - by marco
    Hello, after my last project I had the problem that the client was expecting an object from the server, but while processing the clients input an exception that forces the server to close the socket for security reasons is caught. This causes the client to terminate in a very unpleasant way, the way I decided to deal with this was sending the client a Input status message after each recieved input so that he knows if his input was processed properly or if he needs to throw an exception. So my question: Is there a better/cleaner way to close the socket after an exception is caught?? thanks,

    Read the article

  • Handling credit cards and IOS

    - by Susan Jackie
    I am using NSUrlConnection asyncronous request to transmit credit card information to a secure third party server. I do the following: I get the credit card number, cvv, etc from the uitextfields. Encode the credit card information into a json format. Set as httpd body of the nsurlconnection request as follows: NSURL * url = [[NSURL URLWithString: "https://www.example.com"]; NSMutableURLRequest * request = [[NSMutableURLRequest alloc] initWithURL: url]; [request setHTTPMethod: @"POST"]; [request setValue:@"application/json" forHTTPHeaderField:@"Accept"]; [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; [request setHTTPBody: [NSJSONSerialization dataWithJSONObject: params options: kNilOptions error: &parseError]]; Send this information via asynchronous request to a secure third party server: [NSURLConnection sendAsynchronousRequest:request queue: queue completionHandler:^(NSURLResponse *response, NSData *data, NSError * requestError) { What should I be considering to send user credit card information to a third party server using nsurlconnection asynchronous request?

    Read the article

  • How to add event listners / signals to a simple superman class?

    - by Kabumbus
    I can and would love to use boost or std for this. Sorry - I am new to C++. So I created a really simple program like: #include <iostream> #include <string> using namespace std; class superman { public: string punch(){return cout << "superman: I hit the bad guy!" << endl;}; }; int main() { superman clark; clark.punch(); cin.get(); } I want to add an event listner that would tell me when clark punched and cout something like "superman punched!". How to add such event listner and event function to my class?

    Read the article

  • How to log python exception ?

    - by Maxim Veksler
    Hi, Coming from java, being familiar with logback I used to do try { ... catch (Exception e) { log("Error at X", e); } I would like the same functionality of being able to log the exception and the stacktrace into a file. How would you recommend me implementing this? Currently using boto logging infrastructre, boto.log.info(...) I've looked at some options and found out I can access the actual exception details using this code: import sys try: 1/0 except: exc_type, exc_value, exc_traceback = sys.exc_info() traceback.print_exception(exc_type, exc_value, exc_traceback) I would like to somehow get the string print_exception() throws to stdout so that I can log it. Thank you, Maxim.

    Read the article

  • R: How to tell lapply to ignore an error and process the next thing in the list?

    - by John
    I have an example function below that reads in a date as a string and returns it as a date object. If it reads a string that it cannot convert to a date, it returns an error. testFunction <- function (date_in) { return(as.Date(date_in)) } testFunction("2010-04-06") # this works fine testFunction("foo") # this returns an error Now, I want to use lapply and apply this function over a list of dates: dates1 = c("2010-04-06", "2010-04-07", "2010-04-08") lapply(dates1, testFunction) # this works fine But if I want to apply the function over a list when one string in the middle of two good dates returns an error, what is the best way to deal with this? dates2 = c("2010-04-06", "foo", "2010-04-08") lapply(dates2, testFunction) I presume that I want a try catch in there, but is there a way to catch the error for the "foo" string whilst asking lapply to continue and read the third date?

    Read the article

  • Best way to deal with session handling in Zend Framework

    - by JACK IN THE CRACK
    So I'm starting up in Zend framework and looking to implement a site-wide "User" session.... something I can easily access from ALL modules/controllers in the application. I'm like, should I make a new namespace in the library and extend the controller, like: MyLib_Controller_Action extends Zend_Controller_Action { protected $_userSession; function preDispatch(Zend_Controller_Request_Abstract $req) { $this->_userSession = new Zend_Session_Namespace('user'); } } ANd then have all my controllers/modules/etc extend from that? Or should I create a Plugin or what? How would you go about making this plugin to pass the user session to the controller? Or do I do it in the bootstrap?? Again how to pass to controller? Also should I use Zend_Session_Namespace or Zend_Http_Cookie and also how do I encrypt and xss clean the cookie or is that did automagically?

    Read the article

  • VB.NET handling data between different forms

    - by niuchu
    Hi, I'm writing a simple application - address book. User enters new addresses and they are added as an entry to a list visible on the main form (frmStart). I use one form to add and edit (AddContForm). Add button on the frmStart works fine, however I experience some problems with the edit button as when I press it and enter new data they are added as new entry however the previous entry is still there. Logic is handled by Contact.vb class. Please let me know how to fix this problem. Here is the code: Contact.vb Public Class Contact Public Contact As String Public Title As String Public Fname As String Public Surname As String Public Address As String Private myCont As String Public Property Cont() Get Return myCont End Get Set(ByVal value) myCont = Value End Set End Property Public Overrides Function ToString() As String Return Me.Cont End Function Public Sub Display() Dim C As New Contact C.Cont = frmAddCont.txtTitle.Text C.Fname = frmAddCont.txtFName.Text C.Surname = frmAddCont.txtSName.Text C.Address = frmAddCont.txtAddress.Text frmStart.lstContact.Items.Add(C) End Sub End Class Here is frmStart.vb Public Class frmStart Public Button As String Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click Button = "" Button = "Add" frmAddCont.ShowDialog() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDel.Click Button = "" Button = "Del" Dim DelCont As Contact DelCont = Me.lstContact.SelectedItem() lstContact.Items.Remove(DelCont) End Sub Private Sub lstContact_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstContact.SelectedIndexChanged End Sub Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEdit.Click Button = "" Button = "Edit" Dim C As Contact If lstContact.SelectedItem IsNot Nothing Then C = DirectCast(lstContact.SelectedItem, Contact) frmAddCont.ShowDialog() End If End Sub End Class Here is AddContFrm.vb Public Class frmAddCont Public Class ControlObject Dim Title As String Dim FName As String Dim SName As String Dim Address As String Dim TelephoneNumber As Integer Dim emailAddress As String Dim Website As String Dim Photograph As String End Class Private Sub btnConfirmAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConfirmAdd.Click Dim B As String B = frmStart.Button Dim C As New Contact C.Display() Me.Hide() If B = "Edit" Then C = DirectCast(frmStart.lstContact.SelectedItem, Contact) frmStart.lstContact.SelectedItems.Remove(C) End If End Sub Private Sub frmAddCont_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class

    Read the article

  • Java: custom-exception-error

    - by HH
    $ javac TestExceptions.java TestExceptions.java:11: cannot find symbol symbol : class test location: class TestExceptions throw new TestExceptions.test("If you see me, exceptions work!"); ^ 1 error Code import java.util.*; import java.io.*; public class TestExceptions { static void test(String message) throws java.lang.Error{ System.out.println(message); } public static void main(String[] args){ try { // Why does it not access TestExceptions.test-method in the class? throw new TestExceptions.test("If you see me, exceptions work!"); }catch(java.lang.Error a){ System.out.println("Working Status: " + a.getMessage() ); } } }

    Read the article

  • How do I handle all the exceptions in a C# class where both ctor and finalizer throw exceptions?

    - by Frank
    How can I handle all exceptions for a class similar to the following under certain circumstances? class Test : IDisposable { public Test() { throw new Exception("Exception in ctor"); } public void Dispose() { throw new Exception("Exception in Dispose()"); } ~Test() { this.Dispose(); } } I tried this but it doesn't work: static void Main() { Test t = null; try { t = new Test(); } catch (Exception ex) { Console.Error.WriteLine(ex.Message); } // t is still null } I have also tried to use "using" but it does not handle the exception thrown from ~Test(); static void Main() { try { using (Test t = new Test()) { } } catch (Exception ex) { Console.Error.WriteLine(ex.Message); } } Any ideas how can I work around?

    Read the article

  • How do I store keys pressed

    - by Glycerine
    I would like to store keys pressed when I listen out for the keyDown on the stage. I can add the listener fine, but I'm not getting the character I want out of the event to store it into a string. This is what I have so far: private var _addToString:String = ""; public function Hotwire() { this.addEventListener(KeyboardEvent.KEY_DOWN, keydownEventHandler); } private function keydownEventHandler(ev:KeyboardEvent):void { trace("Key pressed: " + ev.charCode ); addToString(ev.charCode); } private function addToString(value:uint):String { trace(_addToString); return _addToString += String.fromCharCode(value); } Every key I press its returns '0'. How do I convert the chatCode to a real alphanumeric character I can read later? Thanks in advance

    Read the article

  • Handling inverted pixels in bitmapData and bitmap class in as3

    - by intoTHEwild
    I am using bitmapData and bitmap classes to render a mouse cursor on the display screen. The bitmapData consists of an area whose colors should be inverted according to the background color. This is a very basic thing which could be observed with text cursor(the vertical line with two small horizontals on top and bottom), when moved over the text area. I want to be able to do the same with the pixels in my bitmapData, is there a way to find out the background color effectively and invert the color values? In this process i will be redrawing the whole pixels, is there any other efficient way to do that ?

    Read the article

  • NSTableView handling edititng cells correctly

    - by Martins
    Hi All, I have an NSTableView working correctly except when I'm editing one of the table items. If the user is still in edit mode, and it presses the Sheet OK button, the tableiew doesn't update. How do I force the tableview to commit the changes when the user press the ok button (closesheet). Also, how do I handle the ESC Key to cancel the editing? Sorry if the questions looks absurd, but I've been only on developing on Mac for a month.

    Read the article

  • Is there a reason Image.FromFile throws an OutOfMemoryException for an invalid image format?

    - by Arc
    I am writing code that catches this OutOfMemoryException and throws a new, more intuitive exception: /// ... /// <exception cref="FormatException">The file does not have a valid image format.</exception> public static Image OpenImage( string filename ) { try { return Image.FromFile( filename, ); } catch( OutOfMemoryException ex ) { throw new FormatException( "The file does not have a valid image format.", ex ); } } Is this code acceptable to its user, or is OutOfMemoryException intentionally being thrown for a particular reason?

    Read the article

  • Firefox and IE - Firefox handling of <span> inside tables (html and css)

    - by jasrpg
    Hello, I am having difficulties getting a span tag to work properly inside a table. It appears as if the entire span tag is being ignored that is defined anywhere in between table tags in firefox, but in IE this shows up correctly. Maybe I am missing something, but I have created a small example css and html file that displays differently in Firefox and IE. Hopefully someone can tell me why it is behaving this way or how I can rearrange the html to resolve the issue in firefox. ---main.css--- .class1 A:link {color:#960033; text-decoration: none} .class1 A:visited {color:#960033; text-decoration: none} .class1 A:hover {color:#0000FF; font-weight: bold; text-decoration: none} .class1 A:active {color:#0000FF; font-weight: bold; text-decoration: none} .class2 A:link {color:#960033; text-decoration: none} .class2 A:visited {color:#960033; text-decoration: none} .class2 A:hover {color:#0000FF; text-decoration: none} .class2 A:active {color:#0000FF; text-decoration: none} ---test.htm--- <HTML> <HEAD> <title>Title Page</title> <style type="text/css">@import url("/css/main.css");</style> </HEAD> <span class="class1"> <BODY> <table><tr><td> ---Insert Hyperlink---<br> </td></tr> </span><span class="class2"> <tr><td> ---Insert Hyperlink---<br> </td></tr></table> </span> </BODY> </HTML>

    Read the article

  • Shortest way of attaching multiple DOM elements to one event handler using Jquery?

    - by Camsoft
    I need to attach a single event handler to multiple DOM elements using jQuery. I'm currently achieving this using jQuery's each() method. See below: $([elm1, elm2, elm3]).each(function() { this.click(eventHandler); }); I was wondering if there is a way to do this without using the each method and closure. I thought I would be able to do something like: $(elm1, elm2, elm3).click(eventHandler); This kind of statement works using Prototype.js but not in jQuery.The reason I ask the question is because after using both Prototype.js and jQuery I have found that jQuery requires simpler statements to achieve the same tasks in almost every area so I assume there must be a better way of doing this?

    Read the article

  • Handling connection errors in a MDB

    - by Rafa de Castro
    Is it possible to manage connection timeouts or errors in a MessageDrivenBean? You can make the factory to retry connecting a certain number of times but... is it possible to make some actions each time that a reconnection retrial is neccesary? Is it possible to register an ExceptionListener into the MessageDrivenBean's connection somehow? Thanks a lot.

    Read the article

  • Exception while opening file

    - by viswanathan
    Hi I have a VC++ application and in my application i have some basic file operations. Below is the defaulting code CStdioFile cFile; CFileException e; CString sReport; CString sHtmlfile = "testreport.html" OutputDebugString((sHtmlfile)); if (!cFile.Open(sHtmlfile,CFile::modeCreate | CFile::modeWrite, &e )) { } The problem is my application executes this piece of code every few minutes. and it works fine. After several runs of the code the cFile.Open() function fails. I tried to get the error message TCHAR szError[1024]; e.GetErrorMessage(szError,1024); OutputDebugString((szError)); The irony is the szError error message is "No error occured". This again works once i restart my application. Any idea why this occurs. Thanks in advance.

    Read the article

  • Handling incremental Data Modeling Changes in Functional Programming

    - by Adam Gent
    Most of the problems I have to solve in my job as a developer have to do with data modeling. For example in a OOP Web Application world I often have to change the data properties that are in a object to meet new requirements. If I'm lucky I don't even need to programmatically add new "behavior" code (functions,methods). Instead I can declarative add validation and even UI options by annotating the property (Java). In Functional Programming it seems that adding new data properties requires lots of code changes because of pattern matching and data constructors (Haskell, ML). How do I minimize this problem? This seems to be a recognized problem as Xavier Leroy states nicely on page 24 of "Objects and Classes vs. Modules" - To summarize for those that don't have a PostScript viewer it basically says FP languages are better than OOP languages for adding new behavior over data objects but OOP languages are better for adding new data objects/properties. Are there any design pattern used in FP languages to help mitigate this problem? I have read Phillip Wadler's recommendation of using Monads to help this modularity problem but I'm not sure I understand how?

    Read the article

  • ASP SQL Error Handling

    - by J Harley
    Hello, I am using Classic asp and SQL Server 2005. This is code that works (Provided by another member of Stack Overflow): sqlStr = "USE "&databaseNameRecordSet.Fields.Item("name")&";SELECT permission_name FROM fn_my_permissions(null, 'database')" This code checks what permissions I have on a given database - the problem being - if I dont have permission it throws an error and doesn't continue to draw the rest of my page. Anyone got any ideas on remedying this? Many Thanks, Joel

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >