Search Results

Search found 13112 results on 525 pages for 'exception duck'.

Page 119/525 | < Previous Page | 115 116 117 118 119 120 121 122 123 124 125 126  | Next Page >

  • Transaction within transaction

    - by user281521
    Hello, I want to know if open a transaction inside another is safe and encouraged? I have a method: def foo(): session.begin try: stuffs except Exception, e: session.rollback() raise e session.commit() and a method that calls the first one, inside a transaction: def bar(): stuffs try: foo() #<<<< there it is :) stuffs except Exception, e: session.rollback() raise e session.commit() if I get and exception on the foo method, all the operations will be rolled back? and everything else will work just fine? thanks!!

    Read the article

  • Problems trying to format currency with Python (Django)

    - by h3
    I have the following code in Django: import locale locale.setlocale( locale.LC_ALL, '' ) def format_currency(i): return locale.currency(float(i), grouping=True) It work on some computers in dev mode, but as soon as I try to deploy it on production I get this error: Exception Type: TemplateSyntaxError Exception Value: Caught ValueError while rendering: Currency formatting is not possible using the 'C' locale. Exception Location: /usr/lib/python2.6/locale.py in currency, line 240 The weird thing is that I can do this on the production server and it will work without any errors: python manage.py shell >>> import locale >>> locale.setlocale( locale.LC_ALL, '' ) 'en_CA.UTF-8' >>> locale.currency(1, grouping=True) '$1.00' I .. don't get it.i

    Read the article

  • How do I crash the App Pool?

    - by willem
    Our ASP.NET 2 web application handles exceptions very elegantly. We catch exceptions in Global ASAX in Application_Error. From there we log the exception and we show a friendly message to the user. However, this morning we deployed the latest version of our site. It ran ok for half an hour, but then the App Pool crashed. The site did not come back up until we restored the previous release. How can I make the app pool crash and skip the normal exception handler? I'm trying to replicate this problem, but with no luck so far. Update: we found the solution. One of our pages was screenscraping another page. But the URL was configured incorrectly and the page ended up screenscraping itself infinitely, thus causing a stack overflow exception.

    Read the article

  • unable to catch org.hibernate.StaleObjectStateException while deleting record that doesn't exists in database

    - by JAB
    My application has a delete user option. Now in order to check concurrency condition I tried the following use case opened application in chrome and firefox browser. deleted user in firefox now trying to delete the same user in chrome browser I get exception org.hibernate.StaleObjectStateException .. which is right .. since I am trying to delete an object which doesn't exists. But I am not able to catch this exception try{ getHibernateTemplate().delete(userObj); } catch (StaleObjectStateException e) { e.printStackTrace(); } How do i catch this exception ??

    Read the article

  • Broken if statement

    - by Vladimir Nani
    Maybe I am crazy but how that could be? some == null is always false but debugger goes into if-statement body anyway. Any ideas? I have restarted visual studio I have cleaned every bin/obj folder It is not the case that i don`t understand that WindowsIdentity.GetCurrent() may return null. That was my first idea. var some = new object(); if (some == null) { throw new Exception("hi!"); } else { do(); } My code: private void GetCurrentWindowsIdentity() { var identity = WindowsIdentity.GetCurrent() if (identity == null) { throw new Exception(Errors.IdentityIsNullException); } try { if (CurrentAuthenticationWrapper.AuthenticationType == AuthenticationType.Windows) { CurrentLogin = _identity != null ? _identity.Name : string.Empty; } } catch (Exception ex) { ViewManager.ShowError(ex); } _identity = identity; }

    Read the article

  • How do I enumerate installed OleDb providers for current processor architecture?

    - by Rowland Shaw
    I've a project that connects to a dBase format database file, that I've always done in the past with a connection string of the form of: PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=MyData.dbf;Extended Properties=dBASE 5.0 I've had to revisit this recently, and have found that when attempting to create an OleDbConnection with that connection string on x64 machines, that have an x86 install of Office on it, it throws an exception. A quick hack of a fix shows that forcing the application to target x86 only makes it work, but I was hoping to be able to tidy this up and check in advance whether it would fail to create the connection, so that I could customise my import options to suit the available providers. Is it possible to enumerate the available data providers for the current processor architecture? (other than relying on catching the exception -- after all, the Framework Design Guidelines suggest that you should only throw in exceptional circumstances, and you have a method to check if something would throw an exception)

    Read the article

  • How to give FTP address in java?

    - by i2ijeya
    I have written the code which downloads the file from FTP server. Since I have my FTP server locally and I want to access like "ftp://localhost/alfresco". It was alfresco's FTP. I have the following Code public class FtpTransfer { public static final void main(String[] args) { FTPClient ftp = new FTPClient(); FileOutputStream br = null; try { ftp.connect("ftp://localhost/alfresco"); ftp.login("admin", "admin"); String file = "KPUB//Admin//TMM//Pickup//TMM_TO_ARTESIA_06152010220246.xml"; br = new FileOutputStream("file"); ftp.retrieveFile("/"+file, br); System.out.println("Downloaded..."); } catch(IOException exception) { System.out.println("Error : "+exception); } } } The following exception occurs. Error : java.net.UnknownHostException: ftp://localhost/alfresco Please let me know how should I give the FTP Host Address?

    Read the article

  • Logging NHibernate SQL queries

    - by GuestMVCAsync
    Is there a way to access the full SQL query, including the values, inside my code? I am able to log SQL queries using log4net: <logger name="NHibernate.SQL" additivity="false"> <level value="ALL"/> <appender-ref ref="NHibernateSQLFileLog"/> </logger> However, I would like to find a way to log SQL queries from the code also. This way I will log the specific SQL query that causes an exception in my try/catch statement. Right now I have to data-mine the SQLFileLog to find the query that caused the exception when an exception occurs and it is not efficient.

    Read the article

  • Nested for loop error with !null checking an element that doesn't exist

    - by Programatt
    I am currently using nested for loops in a 2D array of size 4,2. When I run my program, I get index out of bounds Exception on the following line else if (state[i][j+1] != null && state[i][j].getFlash() <= state[i][j].getCycleLength() && state[i][j+1].getCycleLength() == state[i][j].getCycleLength()){ } It says the index out of bounds is 2. I would understand the error if I wasn't checking to see if [i][j+1] wasn't null, but I don't understand the exception with the check? I tried moving around the !null check but the program still fails on this line. Any help would be greatly appreciated. Stack trace: Exception in thread "Timer-0" java.lang.ArrayIndexOutOfBoundsException: 2 at NatComp.data$1.run(data.java:67) at java.util.TimerThread.mainLoop(Timer.java:512) at java.util.TimerThread.run(Timer.java:462)

    Read the article

  • Unexpected cross threading issue

    - by haughtonomous
    I'm trying to do something very simple in principal, but I keep getting a cross-threading exception which has me stumped because I'm not setting out to use multiple threads. I have a Windows Forms application. It launches another Windows Forms application (using the System.Diagnostics.Process class) , and catches the Exited event when that application is closed. My application event handler then tries to copy text from the clipboard to a control on the current displayed form. At this point a Cross-threading exception is thrown. I assume that the problem is that the event from the closing application is in another thread (I'm outside my comfort zone here, so bear with me), so the question boils down to "How do I prevent this exception?" I'm somewhat constrained into having to copy from the clipboard, but I could launch the other application a different way if that would solve the problem.

    Read the article

  • wp7 odata v2 dataservicestate save and restore methods tombstoning example needed

    - by MIantosca
    I am looking for an example of how to use the new DataServiceState Save and Restore methods in a WP7 application in order to tombstone a datacontext - I cannot find any examples and the approach I used resulted in an exception this saves the data context correctly PhoneApplicationService.Current.State["DataContext"] = DataServiceState.Save(this.Model.Entities); this attempts to restore it after the app is re-activated var dc = (PhoneApplicationService.Current.State["DataContext"] as DataServiceState).Restore(); but throws an exception An item could not be added to the collection. When items in a DataServiceCollection are tracked by the DataServiceContext, new items cannot be added before items have been loaded into the collection. This is the same exception I get if I try to reload a datacontext that I stored "directly" (without using the DataServiceState.Save method) in the PhoneApplicationService.Current.State. I cannot find any offical documentation on the new ODATA v2 DataServiceState class or examples. thanks Michael

    Read the article

  • Cocos 2D v1.0.1 : Crash at changing CCMenuItemImage normal image

    - by Max
    I retrieve a crash log file, which, after XCode analysis on my archive show the problematic line of code : Date/Time: 2012-12-08 23:48:08.930 +0100 OS Version: iPhone OS 5.1.1 (9B206) Report Version: 104 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x00000000, 0x00000000 Crashed Thread: 0 Last Exception Backtrace: 0 CoreFoundation 0x31a4088f __exceptionPreprocess + 163 1 libobjc.A.dylib 0x3188b259 objc_exception_throw + 33 2 CoreFoundation 0x31a40789 +[NSException raise:format:] + 1 3 Foundation 0x374c73a3 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 91 4 Killer 0x0017ed35 -[CCSprite initWithFile:] (CCSprite.m:201) 5 Killer 0x0017e419 +[CCSprite spriteWithFile:] (CCSprite.m:93) 6 Killer 0x00123101 -[Player makeZombie] (Player.m:1363) 7 Killer 0x00105a51 -[PlayScene endOfKilling:] (PlayScene.m:1438) Which clearly indicates the second of the two following lines is crashing: NSLog(@"images %@ %@",self.zombieImage,self.zombieImageDown); [self.characterSprite setNormalImage:[CCSprite spriteWithFile:self.zombieImage]]; I know that the crash seem to happend when the user is touching the corresponding CCMeanuItemImage, is there a problem if the user is touching it, while we change the normal et selected images of it ? Is this the right manner to change its image (i do it several times during the game) ? Thanks for your ideas

    Read the article

  • How to see variable in calling function in visual studio?

    - by carter-boater
    Hi all, Does anyone know how to watch a variable in calling function. For example: C#: void fn a() { int myVar=9; b(); } b() { Throw new Exception(); } How can I watch myVar when I get the exception in function b?? I have a really big recursive function with in a loop and get an exception in one iteration. I don't know which iteration it belongs to$%^&*(. The thing I did was to promote my intersted variable to global so I can watch them anywhere. However, I don't think that's a good idea only for debug. Thanks everyone!

    Read the article

  • Must JDBC Resultsets and Statements be closed separately although the Connection is closed afterwards?

    - by Mulmoth
    It is said to be a good habit to close all JDBC resources after usage. But if I have the following code, is it necessary to close the Resultset and the Statement? Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; try { conn = // Retrieve connection stmt = conn.prepareStatement(// Some SQL); rs = stmt.executeQuery(); } catch { // Error Handling } finally { try { if (rs != null) rs.close(); } catch (Exception e) {}; try { if (stmt != null) stmt.close(); } catch (Exception e) {}; try { if (conn != null) conn.close(); } catch (Exception e) {}; } The question is if the closing of the connection does the job or if it leaves some resources in use.

    Read the article

  • Checking for 2 exepcted values in Junit

    - by Swift-Tuttle
    Hi, I have a java program which throws an exception with 2 different messages for 2 different scenarios and I want the Junit test case to check for equality for both of these messages. As an example - public void amethod() { // do some processing if(scenario1 == true) { throw new MySystemException("An error occured due to case 1 being incorrect."); } else if(scenario2 == true) { throw new MySystemException("An error occured as case 2 could not be found"); } } Now the JUnit for this would be something like- public void testAMethod() { // do something assertEquals("Expected", "Actual"); } As I understand, in this above example, if I use the Scenario1 exception message the junit will fail when an exception is thrown for Scenario2 and vice versa. I would like to know if there is any other way provided in Junit by which I can use this one test method and check for both the messages for the test to pass? Something like an OR, if possible to provide the "Expected" value with both these expected message. I hope my query is clear enough. Thanks

    Read the article

  • Are there SqlExceptions which throw but commit their data anyway?

    - by Jonn
    I've recently encountered the error: System.Data.SqlClient.SqlException: The transaction log for database 'mydatabase' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases on one of my windows services. It's supposed to retry after catching an Sql Exception, what I didn't expect was that it seemed like the data was still going through (I'm using an SqlBulkCopy btw) regardless of it throwing an exception. I've never encountered this scenario before. I'd like to know if there are other scenarios where such a thing like this might happen, and if this thing is entirely possible at all in the first place? PS. If anyone knows the error code to the above exception, that would help a great deal as well.

    Read the article

  • complex thinking on simple java challenge, how can i fix it?

    - by Rachel
    Simple stuff but somehow not able to crack it, below piece of code is throwing unexpected token at try/catch and unhandled exception:java.io.FileNotFound String fileName = "C:\\GS.xlsx"; try{ CSVReader reader = new CSVReader(new FileReader(fileName)); }catch(Exception e){ } What is the possible issue in here, i know there is something really goofy that am doing in here... public class PositionParserGS { String fileName = "C:\\GS.xlsx"; try{ CSVReader reader = new CSVReader(new FileReader(fileName)); }catch(Exception e){ } } that's the complete code...

    Read the article

  • Select one column from a row in hibernate

    - by ComfortablyNumb
    I am trying to do a simple query to get a unique result back in hibernate here is my code. public String getName(Integer id) { Session session = getSessionFactory().openSession(); String name = (String)session.createSQLQuery("SELECT name FROM users WHERE user_id = :userId").setParameter("userId", id).uniqueResult(); return name; } The name that is being returned is stored as HTML text that includes html syntacx language. I think this is what is causing the problem but it doesnt make sense I just want to return it as a string. It is only happening on this one field name, I can get every other field in the row but this one it gives me the error. I am getting an exception. The exception I am getting is No Dialect mapping for JDBC type: -1; nested exception is org.hibernate.HibernateException How do you query for a specific column on a row in hibernate?

    Read the article

  • Facebook "->api" permissions

    - by Matthieu Marcé
    I have trouble using Facebook auth on my website... I'm using the PHP Sdk and I don't understand why I can use some functions like "getLoginUrl"/"getLoginStatusUrl"/"getUser" (with right answers : the facebook session is started, i get the user's facebook ID) and when I want to use something like $me = $facebook->api("/me/permissions"); or just $me = $facebook->api("/me"); there's always an exception and nothing works ... I guess it has something to do with permissions or token maybe, but I don't know what. When the user sign up on my website, I ask permissions I need with this scope : "email,user_about_me,user_location,read_friendlists,publish_stream" A clue that the permissions seem to be ok is that when the exception occures, I ask the user to sign in again (facebook connect) and no window appears as if everything's ok, but still, the page is reloaded and the exception appears again and again... Please help, Thank you !

    Read the article

  • Type casting problem with java for-each loop

    - by pharma_joe
    Hi, I have traced an issue with an application I am developing, it is giving me a type cast exception. Funny thing is it is saying it cannot cast "entities.Movie cannot be cast to entities.Movie"?! movies is an ArrayList. try { movies = getMovies(); } catch (Exception e) { e.printStackTrace(System.out); } finally { try { for (Movie movie : movies) { output.append(" <tr>\n"); output.append(" <td>" + movie.getId() + "</td>"); output.append(" </tr>\n"); } } catch (Exception e) { e.printStackTrace(System.out); } }

    Read the article

  • GWT : NULL Session

    - by jidma
    I'm using spring4gwt in my project. I have the following login service implementation: @Service("loginService") public class LoginServiceImpl extends RemoteServiceServlet implements LoginService { @Override @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public UserBean checkUser(String userName, String password) throws Exception { HttpSession httpSession = getThreadLocalRequest().getSession(); } } When i call the loginService.checkUser("test","test") (In hosted mode), I get a null pointer exception, as getThreadLocalRequest() returns NULL instead of the actual session. I didn't try in web mode yet. Why would I get a null session ? Does it have something to do with spring4gwt ? Thank you

    Read the article

  • I set a global bug catcher in my application for unhandled exceptions and it is picking up all exceptions

    - by user1632018
    I am trying to figure out why this is happing. In my vb.net application I set a global handler in the ApplicationEvents.vb which I thought would only pick up any unhandled exceptions, although it is picking up every exception that happens in my application whether or not they are handled with try catch blocks. Here is my code in applicationevents Private Sub MyApplication_UnhandledException(ByVal _ sender As Object, ByVal e As _ Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) _ Handles Me.UnhandledException e.ExitApplication = _ MessageBox.Show(e.Exception.Message & _ vbCrLf & "The application has encountered a bug, would you like to Continue?", "An Error has occured.", _ MessageBoxButtons.YesNo, _ MessageBoxIcon.Question) _ = DialogResult.No End Sub In the rest of my application I set normal try catch blocks like this: Try Catch ex as exception End Try Can anyone tell me why this is happening?

    Read the article

  • How to suppress a MongoDDException when proxy can't find a referenced document

    - by Madarco
    We are using Symfony2/DoctrineOdm/MongoDB and when we do: if ($doc.referenceOne != null) { ... } and the $doc.referenceOne contains a MongoDbRef that point to a deleted/lost document, the Doctrine Proxy object raises a MongoDBException. It is possible to tell the Proxy return null instead of raising the exception? Detailed Explanation: Our document: class User { /* @MongoDB\ReferenceOne( ... ) */ private $photo; } If $photo contains a MongoDbRef, but the document is lost/deleted, when we do if ($user.photo) { ... } doctrine will raise a MongoDBException: The "Proxies\DocumentPhotoProxy" document with identifier "4fd8b3ef732bafab7b000000" could not be found We want to suppress the exception since our application can handle null values in that variable. (we could simply log that error, while the exception propagate to a 500 page and disrupt our service)

    Read the article

  • Windows Azure Mobil Services first connection in Android

    - by egente
    my application based windows azure mobil services. Application connecting time is well normally but when login to application first time azure mobile services connection is very slow like 10 second, after connection speed is normally. how can i solve this problem? my codes; private MobileServiceClient mClient; private MobileServiceTable<products> mProductsTable; mClient = new MobileServiceClient( "https://example.azure-mobile.net/", "aaaaaaaaaaaaaaaaaaaaaaaa", this).withFilter(new ProgressFilter());; mProductsTable = mClient.getTable(products.class); mProductsTable.where() .execute(new TableQueryCallback<products>() { public void onCompleted(List<products> result, int count, Exception exception, ServiceFilterResponse response) { if (exception == null) { } else{ Toast.makeText(Product.this, "Ops!!! Error.", 1000).show(); }} });

    Read the article

  • Does 'throw' or 'try...catch' hinder performance?

    - by Richard
    I've been reading all over the place (including here) about when exception should / shouldn't be used. I now want to change my code that would throw to make the method return false and handle it like that, but my question is: Is it the throwing or try..catch-ing that can hinder performance...? What I mean is, would this be acceptable: bool method someMmethod() { try { // ...Do something catch (Exception ex) // Don't care too much what at the moment... { // Output error // Return false } return true // No errors Or would there be a better way to do it? (I'm bloody sick of seeing "Unhandled exception..." LOL!)

    Read the article

< Previous Page | 115 116 117 118 119 120 121 122 123 124 125 126  | Next Page >