Search Results

Search found 5885 results on 236 pages for 'and finally'.

Page 2/236 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • The Manchester lad is finally on twitter

    - by Testas
    Hi you now have another channel to see any communique I have on SQL Server, rather than legnthy blogs you will see my randomn sql thought  address is  http://twitter.com/ctesta_oneill #SQLFAQ will be added to tweets so that it appears on SQLServerFAQ as well Thanks Chris   Chris

    Read the article

  • The Secret to Driving Huge Traffic While Gaining More Money Online Finally Revealed

    Even neophyte internet marketers recognize the weight of a keyword research tool in any online business. Although you may not be truly familiar with how to make use of one yet, you must understand that sooner or later, you need to be trained if you want to be ahead of the competition. This is for the reason that keywords determine principally just how much traffic and sales your business will benefit from.

    Read the article

  • update manager has killed wifi after i finally got it working [closed]

    - by Bobble Off
    HI i had just got my wifi to work properly in 12.04 and I got a pop up from update manager saying there was 100's of updates I needed to install so i installed them it then said I needed to reboot which I did but now my wifi isn't working I go add a new connection and I have no wifi option just Ethernet also the pci card is showing no signs of life (the green light is not light) but when i go in to terminal and type lspci it is showing my wifi card in the list whats gone wrong and how do i fix it???

    Read the article

  • finally and return

    - by abson
    In the below example, class ex8 { public void show() { try { int a=10/0; return;} catch(ArithmeticException e) { System.out.println(e); return ;} finally { System.out.println("Finally"); } } public static void main(String[] args) { new ex8().show(); } } the output is: java.lang.ArithmeticException: / by zero Finally How is it that Finally gets printed in spite of return statement in catch?

    Read the article

  • Unreachable statement when using return in finally?

    - by abson
    this compiles class ex1 { public int show() { try { int a=10/10; return 10; } catch(ArithmeticException e) { System.out.println(e); } finally { System.out.println("Finally"); } System.out.println("hello"); return 20; } } on the other hand this doesn't class ex15 { public int show() { try { int a=10/0; return 10; } catch(ArithmeticException e) { System.out.println(e); } finally { System.out.println("Finally"); return 40; } System.out.println("hello"); return 20; } } and gives unreachable statement System.out.println("hello"); error. why is it so?

    Read the article

  • Delete temp file during finally vs delete output file during catch

    - by Russell
    This is in Java 6. I've seen more than once that people create temp files, do something, then rename it to the output file. Everything is wrapped in a try-finally block, where the temp file is deleted in finally in case something goes wrong in between. try { //do something with tempFile //do something with tempFile //do something with tempFile tempFile.renameTo(outputFile); } finally { if (tempFile.exists()) tempFile.delete() } I was wondering what are the benefits of doing that instead of doing something to the output file directly and delete it in case of exceptions. try { //do something with outputFile //do something with outputFile //do something with outputFile } catch (Exception e) { if (outputFile.exists()) outputFile.delete(); } My guess is that deleting temp files in finally benefits me when the try block can throw many kinds of exceptions. Is my guess right? What else?

    Read the article

  • Weird bug in Java try-catch-finally

    - by kcr
    I'm using JODConverter to convert .xls and .ppt to .pdf format. For this i have code something like try{ //do something System.out.println("connecting to open office"); OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100); System.out.println("connection object created"); connection.connect(); System.out.println("connection to open office successful"); //do something if(!successful) throw new FileNotFoundException(); }catch(Exception e){ System.out.println("hello here"); System.out.println("Caught Exception while converting to PDF "); LOGGER.error("Error in converting media" + e.getMessage()); throw new MediaConversionFailedException(); }finally{ decode_pdf.closePdfFile(); System.out.println("coming in finally"); //do something here } My Output : connecting to open office connection object created coming in finally P.S. return type of method is void How is it possible ? Even if there is some problem in connection.connect(), it s'd come in catch block. confused

    Read the article

  • Does a C# using statement perform try/finally?

    - by Lirik
    Suppose that I have the following code: private void UpdateDB(QuoteDataSet dataSet, Strint tableName) { using(SQLiteConnection conn = new SQLiteConnection(_connectionString)) { conn.Open(); using (SQLiteTransaction transaction = conn.BeginTransaction()) { using (SQLiteCommand cmd = new SQLiteCommand("SELECT * FROM " + tableName, conn)) { using (SQLiteDataAdapter sqliteAdapter = new SQLiteDataAdapter()) { sqliteAdapter.Update(dataSet, tableName); } } transaction.Commit(); } } } The C# documentation states that with a using statement the object within the scope will be disposed and I've seen several places where it's suggested that we don't need to use try/finally clause. I usually surround my connections with a try/finally, and I always close the connection in the finally clause. Given the above code, is it reasonable to assume that the connection will be closed if there is an exception?

    Read the article

  • Behavior of nested finally in Exceptions

    - by kuriouscoder
    Hello: Today at work, I had to review a code snippet that looks similar to this mock example. package test; import java.io.IOException; import org.apache.log4j.Logger; public class ExceptionTester { public static Logger logger = Logger.getLogger(ExceptionTester.class); public void test() throws IOException { new IOException(); } public static void main(String[] args) { ExceptionTester comparator = new ExceptionTester(); try { try { comparator.test(); } finally { System.out.println("Finally 1"); } } catch(IOException ex) { logger.error("Exception happened" ex); // also close opened resources } System.out.println("Exiting out of the program"); } } It's printing the following output.I expected an compile error since the inner try did not have a catch block. Finally 1 Exiting out of the program I do not understand why IOException is caught by the outer catch block. I would appreciate if anyone can explain this, especially by citing stack unwinding process

    Read the article

  • Idea for doing almost same work in both catch & finally(C#3.0)

    - by Newbie
    I have a requirement. I am processing some files and after the processing are done I am archiving those files into an archive folder with timestamp appended. The file archiving and putting time stamp portion I am doing in the Finally block. Now a new requirement has come where I need to mail if something wrong goes in the original files and then I need to archive the same. Now this piece of code I need to handle in the catch block. But if I write the code entirely in the catch block, then it will fire only if there is an exception; otherwise not. So basically I am writing the same pice of code in both the catch and finally block. What is the standard and recommended approach you people think will be better in this case? I am using C#3.0 Thanks.

    Read the article

  • try finally block around every Object.Create?

    - by max
    Hi, I have a general question about best practice in OO Delphi. Currently, I but a try finally block around everywhere, where I create an object, to free that object after usage (to avoid memory leaks). E.g.: aObject := TObject.Create; try aOBject.AProcedure(); ... finally aObject.Free; end; instead of: aObject := TObject.Create; aObject.AProcedure(); .. aObject.Free; To you think, it is good practice, or too much overhead? And what about the performance?

    Read the article

  • "Finally" target for MSBuild

    - by Paul Alexander
    Is there a way to run a certain target after all other targets have been run regardless of their success or failure? try...finally equivalent in MsBuild is related, but only deals with a small group of targets. I need something for the whole package with dozens of sub builds.

    Read the article

  • Java io ugly try-finally block

    - by Tom Brito
    Is there a not so ugly way of treat the close() exception to close both streams then: InputStream in = new FileInputStream(inputFileName); OutputStream out = new FileOutputStream(outputFileName); try { copy(in, out); } finally { try { in.close(); } catch (Exception e) { try { // event if in.close fails, need to close the out out.close(); } catch (Exception e2) {} throw e; // and throw the 'in' exception } out.close(); }

    Read the article

  • try finally in ant

    - by Grzenio
    Hi, In my ant script, which runs the end-to-end integration tests, I first start a process, then do some other stuff, then run the tests, and then I need to make sure I kill the process. However, I need to make sure I kill the process even if something fails (so I need an equivalent to try finally). What is the recommended way of doing it?

    Read the article

  • Actual use of finally block

    - by Jibu P C_Adoor
    I asked to my friend about this question, he said that it is used for destroying the object created during the exception handling. But in c# GC is there for destroying such kinds of unused objects, then what is the actual use of finally block. Tell me with a scenario related to that.

    Read the article

  • Increasing coverage with try-except-finally and a context-manager

    - by Daan Timmer
    This is the flow that I have in my program 277: try: 278: with open(r"c:\afile.txt", "w") as aFile: ...: pass # write data 329: except IOError as ex: ...: print ex 332: finally: 333: if os.path.exists(r"c:\afile.txt"): 334: shutil.copy(r"c:\afile.txt", r"c:\dest.txt") I've got all paths covered except for from line 278 to line 333 I got a normal happy-flow. I stubbed __builtin__.open to raise IOError when the open is called with said file name But how do I go from 278 to 333. Is this even possible? Additional information: - using coverage.py 3.4 (only listing 3.5, we can't currently upgrade to 3.5)

    Read the article

  • Exception is swallowed by finally

    - by fiction
    static int retIntExc() throws Exception{ int result = 1; try { result = 2; throw new IOException("Exception rised."); } catch (ArrayIndexOutOfBoundsException e) { System.out.println(e.getMessage()); result = 3; } finally { return result; } } A friend of mine is a .NET developer and currently migrating to Java and he ask me the following question about this source. In theory this must throw IOException("Exception rised.") and the whole method retIntExc() must throws Exception. But nothing happens, the method returns 2. I've not tested his example, but I think that this isn't the expected behavior. EDIT: Thanks for all answers. Some of you have ignored the fact that method is called retIntExc, which means that this is only some test/experimental example, showing problem in throwing/catching mechanics. I didn't need 'fix', I needed explanation why this happens.

    Read the article

  • What's the difference between the code inside a finally clause and the code located after catch clause?

    - by facebook-100005613813158
    My java code is just like below: public void check()throws MissingParamException{ ...... } public static void main(){ PrintWriter out = response.getWriter(); try { check(); } catch (MissingParamException e) { // TODO Auto-generated catch block out.println("message:"+e.getMessage()); e.printStackTrace(); out.close(); }finally{ out.close(); } //out.close(); } Then, my confusion is: what the difference if I put out.close() in a finally code block or if I just remove finally code block and put out.close() behind catch clause (which has been commented in the code). I know that in both ways, the out.close() will be executed because I know that whether the exception happened, the code behind the catch clause will always be executed.

    Read the article

  • using ‘using’ and scope. Not try finally!

    - by Edward Boyle
    An object that implements IDisposable has, you guessed it, a Dispose() method. In the code you write you should both declare and instantiate any object that implements IDisposable with the using statement. The using statement allows you to set the scope of an object and when your code exits that scope, the object will be disposed of. Note that when an exception occurs, this will pull your code out of scope, so it still forces a Dispose() using (mObject o = new mObject()) { // do stuff } //<- out of Scope, object is disposed. // Note that you can also use multiple objects using // the using statement if of the same type: using (mObject o = new mObject(), o2 = new mObject(), o3 = new mObject()) { // do stuff } //<- out of Scope, objects are disposed. What about try{ }finally{}? It is not needed when you use the using statement. Additionally, using is preferred, Microsoft’s own documents put it this way: As a rule, when you use an IDisposable object, you should declare and instantiate it in a using statement. When I started out in .NET I had a very bad habit of not using the using statement. As a result I ran into what many developers do: #region BAD CODE - DO NOT DO try { mObject o = new mObject(); //do stuff } finally { o.Dispose(); // error - o is out of scope, no such object. } // and here is what I find on blogs all over the place as a solution // pox upon them for creating bad habits. mObject o = new mObject(); try { //do stuff } finally { o.Dispose(); } #endregion So when should I use the using statement? Very simple rule, if an object implements IDisposable, use it. This of course does not apply if the object is going to be used as a global object outside of a method. If that is the case, don’t forget to dispose of the object in code somewhere. It should be made clear that using the try{}finally{} code block is not going to break your code, nor cause memory leaks. It is perfectly acceptable coding practice, just not best coding practice in C#. This is how VB.NET developers must code, as there is no using equivalent for them to use.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >