How to cut a list

Alright, I am pretty new to programming but I do know that 0-0 == 0. Can anyone explain Why I get this error? I have searched high and low and cannot explain this. Every implementation of slicing that I've seen is done like this (except for using bui

PL / SQL WHEN OTHER THEN error

I am writing a simple procedure which should INSERT a row in a table and UPDATE all others with the same foreign key afterwards. My problem is WHEN OTHERS THEN statement. SQL Developer is giving me this error: Error(26,3): PLS-00103: Encountered the

C ++ launch exceptions (need advice)

I was reading The C++ Programming Language by bjarne Stroustrup, especially chapters about exception safety and RAII programming idiom. I am familiar with RAII, but not with the throw of exceptions. Actually, I do not see the throw keyword used very

Exceptions - Throw and catch right away

Does it make sense to throw an exception and directly catch it just to print error? if(...){ } else { try{ throw new Exception(); } catch (Exception e){ e.printStackTrace(); } } There's no need to throw-and-catch, you can simply call: new Exception()

C ++ capture enum value as an exception

I am trying to use an external C++ library which have defined its exceptions as: enum MY_ERRORS { ERR_NONE = 0, ERR_T1, ERR_T2, }; Then in the code exceptions are thrown like this: if(...) { throw ERR_T1; Being new to programming in C++, I would do s

Java InvocationTargetException

I have used EMC Documentum Foundation Classes to perform some actions in documentum repository. The code was working fine. I exported the project as a runnable JAR and then tried to run it. However I got following error and I am not able to understan

How to handle thows / exceptions in a container class safely?

I am currently working on a container class that uses allocators to manage the resources.I'll try to give a short version of what I currently do to resize the container. (The real one is not one-dimensional but the scheme is identical since the alloc

IndexOutOfRangeException Error

The code compiles fine but gives run time errors like Exception in thread "main" BitBin.IndexOutOfRangeException: out of range at BitBin.decmalToBinary.birBin(decmalToBinary.java:52) at BitBin.decmalToBinary.main(decmalToBinary.java:42) I'm not

Selenium WebDriver find blocked java?

I am writing a very simple test case using selenium webdriver. Lets say I have @Test public void github_search() { this.webDriver.get("http://www.github.com"); WebElement findBox = this.webDriver.findElement(By.id("qa")); ...... } in t

__try and __exception portability

Hello and excuse me again I am reading "Detecting Multiprocessor Topology in IA-32 Architecture" from Intel. I was recoding the example. However I read this sentences __try and __except in the code. I found MSDN Microsoft web page some informati

EXE returns errors when DEBUG does not do it

The program has a form that pops up, you enter text in a few fields, then press close. Upon close the information entered is saved to a class newItem. When I press F5 to debug my program everything works fine. But when I run the executable from my de

.NET - Trace the print stack with variables

To improve application error handling I would like to log exceptions stack traces and variables values of each stack level. I've searched for Reflection but couldn't find anything. How can I see the variables?Without using additional tools (such as c

Visual Studio Debug Mode, Allow Exception to kill the program

I have a piece of code in C# that's essentially like the following... WriteFile(); try { RunTest(); } finally { DeleteFile(); } Now this has been planned so that even on failure, it cleans up the files it left behind. This works when not run in debug

Error parsing AppSettings value with a query string

In my AppSettings in web.config, I have something like this: <appSettings> <add key="ExternalSystemUrl" value="http://domain.com/page.aspx?id={0}&action=eat&object=bacon" /> </appSettings> However, it seems th

does anyone know how to catch NSInvalidArgumentException?

is there any way to catch it? Or is this a bug? thanks.It is a bug. Specifically, a bug in your code. NSInvalidArgumentException means you've passed bad data into a method. Frequently this means you've passed nil as an argument that doesn't allow nil

SocketException: No host of this type is known

I want to connect to mysql database from my asp page.So for that as per what my hosting providers told i used the connection string where server is given as "localhost:3309" Dim myConnection As MySqlConnection = New MySqlConnection("server=

Exception Management Context Switching and SEH

I have been doing some reading lately about Exception Handling and the .Net Framework and this seems to have left me more confused then when I started. In CLR via C# Fourth Addition I Read: Also, the .NET Framework exception-handling mechanism is bui

Exceptions by DataContext

I've been doing some searching on the internet, but I can't seem to find the awnser. What exceptions can a DataContext throw? Or to be more specific, what exceptions does the DataContext.SubmitChanges() method throw? EDIT For reference, here a List o

How to register contacts in an address book and list them?

I am working on making an address book in C# 2008. I need to be able to save the contacts and then later display them when the user asked for it. I also need to handle an exception when someone enters an unknown color when writing the person's favori

use exceptions for purposes other than error

Is it a good practice to use exception for managing cases that are not errors ? Like in JavaScript and Python that manage the StopIteration case in generators (yield keyword).It depends on the language. Each language has it's own design and idioms. F

Learning Try-Catch

I'm a Java beginner so please bear with me static int load = 100; static int greet; public void loadDeduct(int cLoad, int c){ int balance; balance = cLoad - 7; System.out.println("Your balance: " + balance); } public void loadDeduct(int tLoad){

Stack procedure in case of structured exceptions

This question provides more clarity on the problem described here. I did some more investigation and found that the stack unwinding is not happening in the following piece of code: class One { public: int x ; }; class Wrapper { public: Wrapper(CStrin