Search Results

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

Page 55/525 | < Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >

  • how to add enum value to list

    - by netmajor
    I have enum: public enum SymbolWejsciowy { K1 , K2 , K3 , K4 , K5 , K6 , K7 , K8 } and I want to create list of this enum public List<SymbolWejsciowy> symbol; but in my way to add enum to List: 1. SymbolWejsciowy symbol ; symbol.Add(symbol = SymbolWejsciowy.K1); 2. symbol.Add(SymbolWejsciowy.K1); I always get Exception Object reference not set to an instance of an object. What i do wrong :/ Please help :)

    Read the article

  • Getting objc_msg send exception while release navigation controller and view controller in presentmo

    - by Rani
    Hi Guys, I'm getting exception in dealloc when I release navcontroller and viewcontroller of presentmodelviewcontrolelr the code that i wrote MasterViewController* viewController = [[MasterViewController alloc] init]; viewController.pathIsFrom = @"Home"; isBookMark=YES; viewController.isBookmark=isBookMark; UINavigationController *itemNavController = [[UINavigationController alloc] initWithRootViewController:viewController]; itemNavController.navigationBar.barStyle= UIBarStyleBlackOpaque; [self.navigationController presentModalViewController:itemNavController animated:YES]; [itemNavController release]; [viewController release]; can anyone help me. Thanks In advance.

    Read the article

  • Method chaining and exceptions in C#

    - by devoured elysium
    If I have a method chain like the following: var abc = new ABC(); abc.method1() .method2() .methodThrowsException() .method3() ; assuming I've defined method1(), method2() and method3() as public ABC method1() { return this; } and methodThrowsException() as public ABC method3() { throw new ArgumentException(); } When running the code, is it possible to know which specific line of code has thrown the Exception, or will it just consider all the method chaining as just one line? I've done a simple test and it seems it considers them all as just one line but Method Chaining says Putting methods on separate lines also makes debugging easier as error messages and debugger control is usually on a line by line basis. Am I missing something, or does that just not apply to C#? Thanks

    Read the article

  • Suggestion for chkstk.asm stackoverflow exception in C++ with Visual Studio 2010

    - by Gulshan
    I am working with an implementation of merge sort. I am doing C++ Visual Studio 2010. But when I took a array of 300000 integers for timing, it is showing an unhandled stackoverflow exception and taking me to a readonly file named "chkstk.asm". I reduced the size to 200000 and it worked. Again the same code worked with C-free 4 editor (mingw 2.95) without any problem while the size was 400000. Do you have any suggestion to get the code working in Visual Studio? May be the recursion in the mergesort is causing the problem.

    Read the article

  • exception 'Zend_Controller_Action_Exception' with message 'Action "index" does not exist and was not

    - by princyp
    Anyone know what this error means? after googling I found a bunch of sites that appear to have the same error? thanks exception 'Zend_Controller_Action_Exception' with message 'Action "index" does not exist and was not trapped in __call()' in /usr/local/zend/apache2/htdocs/pintsy/lib/Zend/Controller/Action.php:485 Stack trace: #0 /usr/local/zend/apache2/htdocs/pintsy/lib/Zend/Controller/Action.php(515): Zend_Controller_Action->__call('indexAction', Array) #1 /usr/local/zend/apache2/htdocs/pintsy/lib/Zend/Controller/Dispatcher/Standard.php(289): Zend_Controller_Action->dispatch('indexAction') #2 /usr/local/zend/apache2/htdocs/pintsy/lib/Zend/Controller/Front.php(946): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #3 /usr/local/zend/apache2/htdocs/pintsy/html/index.php(114): Zend_Controller_Front->dispatch() #4 {main}

    Read the article

  • CryptographicException: Padding is invalid and cannot be removed and Validation of viewstate MAC fai

    - by Chris Marisic
    Monitoring my global exception logs this error seems to be impossible to remove no matter what I do, I thought I finally got rid of it but it's back again. You can see a strack trace of the error on a similar post here. Notes about the environment: IIS 6.0, .NET 3.5 SP1 single server ASP.NET application Steps already taken: <system.web> <machineKey validationKey="big encryption key" decryptionKey="big decryption key" validation="SHA1" decryption="AES" /> In my Page Base for all of my pages protected override void OnInit(EventArgs e) { const string viewStateKey = "big key value"; Page.ViewStateUserKey = viewStateKey; } Also in the source of the page I can see that all of the ASP.NET generated hidden fields are correctly at the top of the page.

    Read the article

  • Occasional InterruptedException when quitting a Swing application

    - by Joonas Pulakka
    I recently updated my computer to a more powerful one, with a quad-core hyperthreading processor (i7), thus plenty of real concurrency available. Now I'm occasionally getting the following error when quitting (System.exit(0)) an application (with a Swing GUI) that I'm developing: Exception while removing reference: java.lang.InterruptedException java.lang.InterruptedException at java.lang.Object.wait(Native Method) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134) at sun.java2d.Disposer.run(Disposer.java:125) at java.lang.Thread.run(Thread.java:619) Well, given that it started to happen with a more concurrency-capable hardware, and it has to do with threads, and it happens occasionally, it's obviously some kind of timing thing. But the problem is that the stack trace is so short. All I have is the listing above. It doesn't include my own code at all, so it's somewhat hard to guess where the bug is. Has anyone experienced something like this before? Any ideas how to start solving it?

    Read the article

  • MyClass cannot be cast to java.lang.Comparable: java.lang.ClassCastException

    - by user2234225
    I am doing a java project and I got this problem and don't know how to fix it. The classes in my project (simplified): public class Item { private String itemID; private Integer price; public Integer getPrice() { return this.price; } } public class Store { private String storeID; private String address; } public class Stock { private Item item; private Store store; private Integer itemCount; public Integer getInventoryValue() { return this.item.getPrice() * this.itemCount; } } Then I try to sort an ArrayList of Stock so I create another class called CompareByValue public class CompareByValue implements Comparator<Stock> { @Override public int compare(Stock stock1, Stock stock2) { return (stock1.getInventoryValue() - stock2.getInventoryValue()); } } When I try to run the program, it gives the error: Exception in thread "main" java.lang.ClassCastException: Stock cannot be cast to java.lang.Comparable Anyone know what's wrong?

    Read the article

  • WCF Client Proxy State

    - by RemotecUk
    Hi, how do I test the state of my proxy before making calls to my WCF service. I have a duplex channel created using a duplex channel factory. Before making any calls to the server I want to check the state of the proxy object created from the channel factory. I saw this in a book... (to be used in immediate window) ? ((ICommunicationObject)flsProxy).State But it gave this exception... Cannot obtain fields or call methods on the instance of type 'System.ServiceModel.ICommunicationObject' because it is a proxy to a remote object. Would be grateful for any ideas how this can be tested, or is it better to just catch exceptions. Thanks.

    Read the article

  • C++ Access violation when calling dll function

    - by Manjoor
    I have a function definition in my VC++ Win32 DLL DEMO2_API void ProcessData(char* i_buff, unsigned short i_len, char* o_buf, unsigned *o_len, unsigned short *errorCode) { __describe (i_buff,&i_len,o_buf,o_len,errorCode); } This dll function is called by a c# application. When called, it generate access violation exception. After reasearching i found, the cause for my problem. http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/6e843243-baf4-4eb1-8a20-c691ad47762c But could not understand what exactly they are doinng in example code. Can someone explain it so me? And what would be P/Invoke signature in c# after externally allocating memory?

    Read the article

  • Date exception when trying to use date method

    - by Simon Andi
    Hi, I have defined a object model where one of the array elements is a string public static String[] columnNames6 = {"Total Shares", "Total Calls", "Call Strike", "Call Premium", "Call Expiry" }; public static Object[][] data6 = { { new Double(0), new Double(0), new Double(0), new Double(0),"dd/mm/yyyy"}, }; I then use the following code to get the date so that I can use the data method but having no joy - Can someone please tell me why it is throwing an exception after I do this String ExpiryDate = (String)GV.data6[0][4]; System.out.println("DATE STRING IS: " + ExpiryDate); Date EndOptionDate = new Date(ExpiryDate); // SOMETHING WRONG HERE even though it compiles okay //Get Todays's Date Date TodaysDate = new Date(); //Calculate Days Option Expiry long DaysDifference = EndOptionDate.getTime() - TodaysDate.getTime(); Would really appreciate some help as really stuck not sure how I should code the line in bold - new to java, so please excuses my lack of knowledge looked at tutorials can't seem to move forward. Thanks Simon

    Read the article

  • Java exception reading xml file

    - by xain
    Hi, I have the following xml file: <?xml version="1.0" encoding="UTF-8"?> <c1> <c2 id="0001" n="CM" urlget="/at/CsM" urle="/E/login.jsp"> </c2> <c2 id="0002" n="C2M" urlget="/a2t/CsM" urle="/E2/login.jsp"> </c2> </c1> I'm trying to load c2's attributes this way: Document d = DocumentBuilderFactory.newInstance() .newDocumentBuilder() .parse("epxy.xml"); Element c1 = d.getDocumentElement(); Element c2 = (Element)c1.getFirstChild(); while (c2 != null) { ... c2 = (Element)c2.getNextSibling(); } But I get the exception java.lang.ClassCastException: org.apache.xerces.dom.DeferredTextImpl incompatible with org.w3c.dom.Element in the line Element c2 = (Element)c1.getFirstChild(); before the loop. Any hints ? Thanks.

    Read the article

  • Connection Timeout exception for a query using ADO.Net

    - by dragon
    Update: Looks like the query does not throw any timeout. The connection is timing out. This is a sample code for executing a query. Sometimes, while executing time consuming queries, it throws a timeout exception. I cannot use any of these techniques: 1) Increase timeout. 2) Run it asynchronously with a callback. This needs to run in a synchronous manner. please suggest any other techinques to keep the connection alive while executing a time consuming query? private static void CreateCommand(string queryString, string connectionString) { using (SqlConnection connection = new SqlConnection( connectionString)) { SqlCommand command = new SqlCommand(queryString, connection); command.Connection.Open(); command.ExecuteNonQuery(); } }

    Read the article

  • skip-limit ignored for skippable exception thrown from writer

    - by ck
    i am working on a project with spring batch 2.0.2 and have skippable exception set up in the config. for exceptions thrown from the processor everything works fine. it skips and once the limit is execeed the job fails (or stops). for exceptions thrown from the writer (same chunk) it keeps skipping. the skip-limit doesnt seem to matter. maybe i missunderstood and skipping and writer don't go together or maybe i am missing a configuration. does anyone know how to skip issues - with a limit - within the writer properly?

    Read the article

  • controlling if exceptions are swallowed by a static boolean

    - by sandis
    So we are a few guys developing this product that is communicating with a really unstable server. It often returns very strange and corrupt data. During testing we want the resulting crashes to be loud, so we discover them. But every other day we need to demonstrate our product for a potential customer. To the customer the errors will go undiscovered if we just swallow them. I am thinking about implementing something like this around all server communication to quickly switch between swallowing exceptions and crashing: try { apiCall(); } catch (Exception e) { if(!SWALLOW_EXCEPTION) { throw e; } } Is this an awesome idea, or can it be done in a better way?

    Read the article

  • Exception in thread "main" java.lang.NoClassDefFoundError: while running .bat file

    - by Manu
    hi, i have bat file like below with name (myBat.bat) @echo off set CLASSPATH=%CLASSPATH%;C:\Documents and Settings\nchakk\Desktop\3611 java\ javac packbat.inter.java javac packbat.samplepack.java java packbat.inter java packbat.samplepack pause //interface "inter" inside package packbat package packbat; public interface inter { int i=10; } //my main()class inside package packbat package packbat; public class samplepack implements inter { public static void main(String s[]) { System.out.println(i); } } after clicking that .bat file it diplay error like below Exception in thread "main" java.lang.NoClassDefFoundError: packbat/inter Caused by: java.lang.ClassNotFoundException: packbat.inter how to run tat .bat file without error. Pls reply ASAP.Thanks in advance

    Read the article

  • How to rectify InvalidActiveXStateException in WPF?

    - by Gagan
    I am trying to make a WPF Application and using the Visio Controls. I have a dll named AxInterop.Microsoft.Office.Interop.VisOcx and I refer it to instantiate an object of the type AxDrawingControl(). Now as soon as I write this code: AxDrawingControl objDrawControl=new AxDrawingControl(); and check the attributes of this object objDrawControl in the debug mode, I see this message: Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateException' was thrown. Here is how it looks like: Please help me to get this thing resolved! Please! I just realized the image isn't visible. So here is the link of the image showing the error message: http://www.freeimagehosting.net/uploads/fed103f4d3.jpg

    Read the article

  • What to do of exceptions when implementing java.lang.Iterator

    - by Vincent Robert
    The java.lang.Iterator interface has 3 methods: hasNext, next and remove. In order to implement a read-only iterator, you have to provide an implementation for 2 of those: hasNext and next. My problem is that these methods does not declare any exceptions. So if my code inside the iteration process declares exceptions, I must enclose my iteration code inside a try/catch block. My current policy has been to rethrow the exception enclosed in a RuntimeException. But this has issues because the checked exceptions are lost and the client code no longer can catch those exceptions explicitly. How can I work around this limitation in the Iterator class? Here is a sample code for clarity: class MyIterator implements Iterator { @Override public boolean hasNext() { try { return implementation.testForNext(); } catch ( SomethingBadException e ) { throw new RuntimeException(e); } } @Override public boolean next() { try { return implementation.getNext(); } catch ( SomethingBadException e ) { throw new RuntimeException(e); } } ... }

    Read the article

  • Structuremap Stackoverflow Exception

    - by Jason Young
    I keep getting a stackoverflow exception when I call "GetInstance" (the last line). All, yes ALL of my types implement ITracker. MultiTracker has a constructor with a single parameter, which is an array of ITracker's. It seems like StructureMap is ignoring the fact that I told it that MultiTracker is the default class I want when requesting the type ITracker. I just can't get it to work. Any thoughts? Container = new Container(x => { //Multitracker takes ITracker[] in its constructor x.ForRequestedType<MultiTracker>().TheDefault.Is.OfConcreteType<MultiTracker>().TheArrayOf<ITracker>().Contains(z => { z.OfConcreteType<ConcreteType1>(); //ConcreteType1 : ITracker z.OfConcreteType<ConcreteType2>(); //ConcreteType2 : ITracker }); x.ForRequestedType<ITracker>().TheDefault.Is.OfConcreteType<MultiTracker>(); }); //Run a test - this explodes Container.GetInstance<ITracker>();

    Read the article

  • ObjectDisposedException when outputting to console

    - by Sarah Vessels
    If I have the following code, I have no runtime or compilation problems: if (ConsoleAppBase.NORMAL_EXIT_CODE == code) { StdOut.WriteLine(msg); } else { StdErr.WriteLine(msg); } However, in trying to make this more concise, I switched to the following code: (ConsoleAppBase.NORMAL_EXIT_CODE == code ? StdOut : StdErr ).WriteLine(msg); When I have this code, I get the following exception at runtime: System.ObjectDisposedException: Cannot write to a closed TextWriter Can you explain why this happens? Can I avoid it and have more concise code like I wanted?

    Read the article

  • When is a C++ terminate handler the Right Thing(TM)?

    - by Joseph Garvin
    The C++ standard provides the std::set_terminate function which lets you specify what function std::terminate should actually call. std::terminate should only get called in dire circumstances, and sure enough the situations the standard describes for when it's called are dire (e.g. an uncaught exception). When std::terminate does get called the situation seems analagous to being out of memory -- there's not really much you can sensically do. I've read that it can be used to make sure resources are freed -- but for the majority of resources this should be handled automatically by the OS when the process exits (e.g. file handles). Theoretically I can see a case for if say, you needed to send a server a specific message when exiting due to a crash. But the majority of the time the OS handling should be sufficient. When is using a terminate handler the Right Thing(TM)? Update: People interested in what can be done with custom terminate handlers might find this non-portable trick useful.

    Read the article

  • "Unsupported Image Type" exception in only few images...

    - by Nitz
    In my java-swing project. I have one frame in which user can drop the images and save that images in database. Now this work perfectly but their are some images which is not showing. This are images Image 1 , Images 2 which is not supporting .. this are some images which are not reading... and its showing me exception, like javax.imageio.IIOException: Unsupported Image Type Can i check that, is the image which user had dropped is supported or not? And can i convert that file which is not supported into supported file in java?

    Read the article

  • Access Violation Exception only appearing when running C# app without debugger attached

    - by Jon
    I have an application that works fine in Visual Studios 2008, and I am trying to get it into VS 2010 in order to use .NET 4, and I have a really weird problem. When I run the code from either Release mode or Debug mode with the debugger attached (F5), I have no problems running the program. However, when I run the program from either Release or Debug without the debugger attached (Shift+F5), I get an Access Violation Exception when I attempt to run some code in a dll from GDCM. I've created the dlls by using CMake and Swig and following the instructions here adjusting the instructions where necessary to build for VS 2010 and .NET 4. Does any one have any ideas why this is happening and how I can fix it?

    Read the article

  • Debugging runtime error "Terminating app due to uncaught exception 'NSInternalInconsistencyException

    - by Bill
    I'm going through the Beginning iPhone Development book & stuck in chapter 9. I've spent a few hours trying to debug this error w/o avail: 2010-05-01 19:27:51.361 Nav2[4113:20b] *** Assertion failure in -[UITableView _createPreparedCellForGlobalRow:withIndexPath:], /SourceCache/UIKit/UIKit-984.38/UITableView.m:4709 2010-05-01 19:27:51.362 Nav2[4113:20b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:' 2010-05-01 19:27:51.364 Nav2[4113:20b] Stack: ( ... ) I'm not looking for help w/ the book, but tips for how to debug this error? Can I pin down which of my cellForRowAtIndexPath methods is the problem? And how to inspect the type? Or other things should I look at?

    Read the article

  • Making swap faster, easier to use and exception-safe

    - by FredOverflow
    I could not sleep last night and started thinking about std::swap. Here is the familiar C++98 version: template <typename T> void swap(T& a, T& b) { T c(a); a = b; b = c; } If a user-defined class Foo uses external ressources, this is inefficient. The common idiom is to provide a method void Foo::swap(Foo& other) and a specialization of std::swap<Foo>. Note that this does not work with class templates since you cannot partially specialize a function template, and overloading names in the std namespace is illegal. The solution is to write a template function in one's own namespace and rely on argument dependent lookup to find it. This depends critically on the client to follow the "using std::swap idiom" instead of calling std::swap directly. Very brittle. In C++0x, if Foo has a user-defined move constructor and a move assignment operator, providing a custom swap method and a std::swap<Foo> specialization has little to no performance benefit, because the C++0x version of std::swap uses efficient moves instead of copies: #include <utility> template <typename T> void swap(T& a, T& b) { T c(std::move(a)); a = std::move(b); b = std::move(c); } Not having to fiddle with swap anymore already takes a lot of burden away from the programmer. Current compilers do not generate move constructors and move assignment operators automatically yet, but as far as I know, this will change. The only problem left then is exception-safety, because in general, move operations are allowed to throw, and this opens up a whole can of worms. The question "What exactly is the state of a moved-from object?" complicates things further. Then I was thinking, what exactly are the semantics of std::swap in C++0x if everything goes fine? What is the state of the objects before and after the swap? Typically, swapping via move operations does not touch external resources, only the "flat" object representations themselves. So why not simply write a swap template that does exactly that: swap the object representations? #include <cstring> template <typename T> void swap(T& a, T& b) { unsigned char c[sizeof(T)]; memcpy( c, &a, sizeof(T)); memcpy(&a, &b, sizeof(T)); memcpy(&b, c, sizeof(T)); } This is as efficient as it gets: it simply blasts through raw memory. It does not require any intervention from the user: no special swap methods or move operations have to be defined. This means that it even works in C++98 (which does not have rvalue references, mind you). But even more importantly, we can now forget about the exception-safety issues, because memcpy never throws. I can see two potential problems with this approach: First, not all objects are meant to be swapped. If a class designer hides the copy constructor or the copy assignment operator, trying to swap objects of the class should fail at compile-time. We can simply introduce some dead code that checks whether copying and assignment are legal on the type: template <typename T> void swap(T& a, T& b) { if (false) // dead code, never executed { T c(a); // copy-constructible? a = b; // assignable? } unsigned char c[sizeof(T)]; std::memcpy( c, &a, sizeof(T)); std::memcpy(&a, &b, sizeof(T)); std::memcpy(&b, c, sizeof(T)); } Any decent compiler can trivially get rid of the dead code. (There are probably better ways to check the "swap conformance", but that is not the point. What matters is that it's possible). Second, some types might perform "unusual" actions in the copy constructor and copy assignment operator. For example, they might notify observers of their change. I deem this a minor issue, because such kinds of objects probably should not have provided copy operations in the first place. Please let me know what you think of this approach to swapping. Would it work in practice? Would you use it? Can you identify library types where this would break? Do you see additional problems? Discuss!

    Read the article

< Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >