Search Results

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

Page 50/525 | < Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >

  • Bad_alloc exception when using new for a struct c++

    - by bsg
    Hi, I am writing a query processor which allocates large amounts of memory and tries to find matching documents. Whenever I find a match, I create a structure to hold two variables describing the document and add it to a priority queue. Since there is no way of knowing how many times I will do this, I tried creating my structs dynamically using new. When I pop a struct off the priority queue, the queue (STL priority queue implementation) is supposed to call the object's destructor. My struct code has no destructor, so I assume a default destructor is called in that case. However, the very first time that I try to create a DOC struct, I get the following error: Unhandled exception at 0x7c812afb in QueryProcessor.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0012f5dc.. I don't understand what's happening - have I used up so much memory that the heap is full? It doesn't seem likely. And it's not as if I've even used that pointer before. So: first of all, what am I doing that's causing the error, and secondly, will the following code work more than once? Do I need to have a separate pointer for each struct created, or can I re-use the same temporary pointer and assume that the queue will keep a pointer to each struct? Here is my code: struct DOC{ int docid; double rank; public: DOC() { docid = 0; rank = 0.0; } DOC(int num, double ranking) { docid = num; rank = ranking; } bool operator>( const DOC & d ) const { return rank > d.rank; } bool operator<( const DOC & d ) const { return rank < d.rank; } }; //a lot of processing goes on here; when a matching document is found, I do this: rank = calculateRanking(table, num); //if the heap is not full, create a DOC struct with the docid and rank and add it to the heap if(q.size() < 20) { doc = new DOC(num, rank); q.push(*doc); doc = NULL; } //if the heap is full, but the new rank is greater than the //smallest element in the min heap, remove the current smallest element //and add the new one to the heap else if(rank > q.top().rank) { q.pop(); cout << "pushing doc on to queue" << endl; doc = new DOC(num, rank); q.push(*doc); } Thank you very much, bsg.

    Read the article

  • Exception throwing

    - by Ben Aston
    In C#, will the folloing code throw e containing the additional information up the call stack? ... catch(Exception e) { e.Data.Add("Additional information","blah blah"); throw; }

    Read the article

  • Javascript permission denied. Not cross domain?

    - by Dan
    I'm working on a web app that very rarely returns a Javacript permission denied error when attempting to access document elements. I'm well aware of cross-domain issues and I am actively pursuing them as a possible cause. My question is: are there other possible causes for a permission denied exception? Just want to make sure I'm looking in to all possible avenues. Thanks!

    Read the article

  • Spring 3 MVC - Form Failure Causes Exception When Reloading JSP

    - by jboyd
    Using Spring 3 MVC, please bear with the long code example, it's quite simple, but I want to make sure all relevant information is posted. Basically here is the use case: There is a registration page, a user can login, OR fill out a registration form. The login form is a simple HTML form, the registration form is a more complicated, Spring bound form that uses a RegistrationFormData bean. Here is the relevant code: UserController.java ... @RequestMapping(value = "/login", method = RequestMethod.GET) public String login(Model model) { model.addAttribute("registrationInfo", new ProfileAdminFormData()); return "login"; } ... @RequestMapping(value = "/login.do", method = RequestMethod.POST) public String doLogin( @RequestParam(value = "userName") String userName, @RequestParam(value = "password") String password, Model model) { logger.info("login.do : userName=" + userName + ", password=" + password); try { getUser().login(userName, password); } catch (UserNotFoundException ex) { logger.error(ex); model.addAttribute("loginError", ex.getWebViewableErrorMessage()); return "login"; } return "redirect:/"; } ... @RequestMapping(value = "/register.do") public String register( @ModelAttribute(value = "registrationInfo") ProfileAdminFormData profileAdminFormData, BindingResult result, Model model) { //todo: redirect if (new RegistrationValidator(profileAdminFormData, result).validate()) { try { User().register(profileAdminFormData); return "index"; } catch (UserException ex) { logger.error(ex); model.addAttribute("registrationErrorMessage", ex.getWebViewableErrorMessage()); return "login"; } } return "login"; } and the JSP: ... <form:form commandName="registrationInfo" action="register.do"> ... So the problem here is that when login fails I get an exception because there is no bean "registrationInfo" in the model attributes. What I need is that regardless of the path through this controller that the "registrationInfo" bean is not null, that way if login fails, as opposed to registration, that bean is still in the model. As you can see I create the registrationInfo object explicitly in my controller in the method bound to "/login", which is what I thought was going to be kind of a setup method" Something doesn't feel right about the "/login" method which sets up the page, but I needed to that in order to get the page to render at all without throwing an exception because there is no "registrationInfo" model attribute, as needed by the form in the JSP

    Read the article

  • FileSystemWatcher and System Out of Memory Exception

    - by Saurabh
    A little context There is a wpf based application which i left opened for 2-3 days without performing any activity throws out of memory exception , this is very Weird situation and does not happen all of the time. During this ideal activity , my application does nt perform any activity but just a file system watcher contineously watching a shared location , so i thought that would be a problem but i am not sure. Any suggestion is always welcomed.

    Read the article

  • Python RegExp exception

    - by Jasie
    How do I split on all nonalphanumeric characters, EXCEPT the apostrophe? re.split('\W+',text) works, but will also split on apostrophes. How do I add an exception to this rule? Thanks!

    Read the article

  • Runtime exception when creating Bundle in JUnit test

    - by Shane Fulmer
    I'm testing some Java code that uses an android Bundle, and am getting a runtime exception whenever I create a Bundle in the unit test. The error I'm getting is java.lang.runtimeException at android.os.Bundle when I create the Bundle. It is running with the android SDK in the run configuration. Has anyone run into this problem before? Thanks!

    Read the article

  • Naming Exception when bounding to the home interface

    - by Nila
    Hi! I'm new to ejb. I'm trying to call the ejb from the servlet. But, I'm getting the NamingException. I'm directly running the servlet from the netbeans to check whether it is calling the ejb. But, it is not working. I'm getting the exception as home interface not bound. What is the solution for this?

    Read the article

  • Exceptions not being caught

    - by Thomas Freudenberg
    We have following code: try { // some code throwing MyException } catch (MyException ex) { // [1] // no (re)throw here } catch (Exception ex) { if (ex is MyException) { // [2] } } If we run the code without a debugger attached, everything runs fine. However, IF we debug the code, we don't get to point [1] but [2]. As far as I understand the language specification this should not be possible. Even weirder, this code used run fine even while debugging. The strange behavior started only a few days ago.

    Read the article

  • Uncaught exception 'Zend_Controller_Dispatcher_Exception'

    - by saurabh
    Hi I am getting the following error on running zendframework . Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in F:\wamp\www\helloworld\library\Zend\Controller\Dispatcher\Standard.php:245 Stack trace: #0 F:\wamp\www\helloworld\library\Zend\Controller\Front.php(946): Zend_Controller_Dispatcher_Standard-dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 F:\wamp\www\helloworld\library\Zend\Controller\Front.php(212): Zend_Controller_Front-dispatch() #2 F:\wamp\www\helloworld\web_root\index.php(10): Zend_Controller_Front::run('../application/...') #3 {main} thrown in F:\wamp\www\helloworld\library\Zend\Controller\Dispatcher\Standard.php on line 245 please help me out.

    Read the article

  • java classcast exception

    - by shil
    hi i have problems in converting an XML document type into a Document object.. this is the piece of code line 1 : Document doc=null; line 2 : doc = (Document) parser.parse(sourceFile); for this line 2 it throws java classcast exception.. without the typecast it shows error as "Type mismatch: cannot convert from org.w3c.dom.Document to javax.swing.text.Document" how do i now typecast properly? any suggestions??

    Read the article

  • empty sharepoint user profile property throw an exception

    - by James123
    I have a user profile property. user not assigned any value that property. If I use below code. It is thorwing exception " object reference not set to an instance of an object " userprof["OptOut"].ToString() I tried all types like if (userprof["OptOut"] != null) OR if(userprof["OptOut"].Value != null) nothing worked out for me. Here userProf object has value. userprof["OptOut"].Value is null How to handle this?

    Read the article

  • Custom Elmah YSOD data

    - by user144612
    I'm using Elmah with ASP.NET and wondering how I would add custom data, such as a session variable, to an unhandled exception email. I've tried several handlers in the Global.asax file but can't seem to find the right one.

    Read the article

  • GAE transaction exception suggestion

    - by bach
    Hi, The current situation encourages the design of the system to split object fields to seperate objects in order to reduce the chance of the JDOCanRetryException to be thrown. If we could have the fields that were changed by the other client who changed the object in the exception content itself we could deside whether to re-retrieve the object or ignore...

    Read the article

  • Exception: Need to specify class name in environment or system property: java.naming.factory.initial

    - by DanDan
    When i run a JMS related application, i am encountering the following exception error. javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial We are using Sun Application Server 9.1 Any idea what are we missing? I already tried adding the following but result still the same Properties env = new Properties(); env.put("java.naming.factory.initial","com.sun.jndi.cosnaming.CNCtxFactory"); Context ctx = new InitialContext(env);

    Read the article

  • Android full Screen flag gives an exception

    - by sukitha
    In my android app I set this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN ); Then my touch screen event doesnt’ work any more. Further Explaining, I have a button and onClick it changes the contentView by setContentView(R.layout.choose_player);. It works fine. But if you take the focus to the button by the trackball(making it yellow) and tap on it, it gives the exception. java.lang.IllegalArgumentException: parameter must be a descendant of this view

    Read the article

< Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >