Search Results

Search found 252976 results on 10120 pages for 'stack overflow'.

Page 28/10120 | < Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • How do I implement a fibonacci sequence in java using try/catch logic?

    - by Lars Flyger
    I know how to do it using simple recursion, but in order to complete this particular assignment I need to be able to accumulate on the stack and throw an exception that holds the answer in it. So far I have: public static int fibo(int index) { int sum = 0; try { fibo_aux(index, 1, 1); } catch (IntegerException me) { sum = me.getIntValue(); } return sum; } fibo_aux is supposed to throw an IntegerException (which holds the value of the answer that is retireved via getIntValue) and accumulates the answer on the stack, but so far I can't figure it out. Can anyone help?

    Read the article

  • How to delete the widget from the stack in Qt

    - by Solitaire
    Hi, i am using Qstackedwidget to switch between the views, i will be able to traverse between the views, i am facing problem in some scenario, where i do not require the widgets, i want to remove them completely.. stackedwidget provides the functionality to removewidgets, still the ownership of the widget will be there, i mean widget will be hidden. i dont want this to be happen, when i call remove widget the widget should be deleted. how to handle this?

    Read the article

  • Closing Question Rights in Stack over flow

    - by Asim Sajjad
    I have posted my Question and some one has closed that question, but i didn't get my answer from any of the viewer who have view my question or post theire answer, how can anyone close question when I don't get answer or statisfied with the answer posted against my question??? Why people close the question without permission of the question owner ???

    Read the article

  • Stack usage with MMX intrinsics and Microsoft C++

    - by arik-funke
    I have an inline assembler loop that cumulatively adds elements from an int32 data array with MMX instructions. In particular, it uses the fact that the MMX registers can accommodate 16 int32s to calculate 16 different cumulative sums in parallel. I would now like to convert this piece of code to MMX intrinsics but I am afraid that I will suffer a performance penalty because one cannot explicitly intruct the compiler to use the 8 MMX registers to accomulate 16 independent sums. Can anybody comment on this and maybe propose a solution on how to convert the piece of code below to use intrinsics? == inline assembler (only part within the loop) == paddd mm0, [esi+edx+8*0] ; add first & second pair of int32 elements paddd mm1, [esi+edx+8*1] ; add third & fourth pair of int32 elements ... paddd mm2, [esi+edx+8*2] paddd mm3, [esi+edx+8*3] paddd mm4, [esi+edx+8*4] paddd mm5, [esi+edx+8*5] paddd mm6, [esi+edx+8*6] paddd mm7, [esi+edx+8*7] ; add 15th & 16th pair of int32 elements esi points to the beginning of the data array edx provides the offset in the data array for the current loop iteration the data array is arranged such that the elements for the 16 independent sums are interleaved.

    Read the article

  • Do you have suggestions for these assembly mnemonics?

    - by Noctis Skytower
    Greetings! Last semester in college, my teacher in the Computer Languages class taught us the esoteric language named Whitespace. In the interest of learning the language better with a very busy schedule (midterms), I wrote an interpreter and assembler in Python. An assembly language was designed to facilitate writing programs easily, and a sample program was written with the given assembly mnemonics. Now that it is summer, a new project has begun with the objective being to rewrite the interpreter and assembler for Whitespace 0.3, with further developments coming afterwards. Since there is so much extra time than before to work on its design, you are presented here with an outline that provides a revised set of mnemonics for the assembly language. This post is marked as a wiki for their discussion. Have you ever had any experience with assembly languages in the past? Were there some instructions that you thought should have been renamed to something different? Did you find yourself thinking outside the box and with a different paradigm than in which the mnemonics were named? If you can answer yes to any of those questions, you are most welcome here. Subjective answers are appreciated! Stack Manipulation (IMP: [Space]) Stack manipulation is one of the more common operations, hence the shortness of the IMP [Space]. There are four stack instructions. hold N Push the number onto the stack copy Duplicate the top item on the stack copy N Copy the nth item on the stack (given by the argument) onto the top of the stack swap Swap the top two items on the stack drop Discard the top item on the stack drop N Slide n items off the stack, keeping the top item Arithmetic (IMP: [Tab][Space]) Arithmetic commands operate on the top two items on the stack, and replace them with the result of the operation. The first item pushed is considered to be left of the operator. add Addition sub Subtraction mul Multiplication div Integer Division mod Modulo Heap Access (IMP: [Tab][Tab]) Heap access commands look at the stack to find the address of items to be stored or retrieved. To store an item, push the address then the value and run the store command. To retrieve an item, push the address and run the retrieve command, which will place the value stored in the location at the top of the stack. save Store load Retrieve Flow Control (IMP: [LF]) Flow control operations are also common. Subroutines are marked by labels, as well as the targets of conditional and unconditional jumps, by which loops can be implemented. Programs must be ended by means of [LF][LF][LF] so that the interpreter can exit cleanly. L: Mark a location in the program call L Call a subroutine goto L Jump unconditionally to a label if=0 L Jump to a label if the top of the stack is zero if<0 L Jump to a label if the top of the stack is negative return End a subroutine and transfer control back to the caller halt End the program I/O (IMP: [Tab][LF]) Finally, we need to be able to interact with the user. There are IO instructions for reading and writing numbers and individual characters. With these, string manipulation routines can be written. The read instructions take the heap address in which to store the result from the top of the stack. print chr Output the character at the top of the stack print int Output the number at the top of the stack input chr Read a character and place it in the location given by the top of the stack input int Read a number and place it in the location given by the top of the stack Question: How would you redesign, rewrite, or rename the previous mnemonics and for what reasons?

    Read the article

  • not output exception stack trace in EUnit

    - by hpyhacking
    I'm write a test with EUnit, but not anything exception detail output in console. exp_test() -> ?assertEqual(0, 1/0). Run this module:exp_test() in the Erlang Shell output following ** exception error: bad argument in an arithmetic expression in function exp_test:'-exp_test/0-fun-0-'/1 (src/test/eunit/xxx_test.erl, line 8) But in EUnit output following > eunit:test(xxx). > xxx_test: exp_test...*failed* ::badarith EUnit not output anything exception trace info Im trying the verbose config in eunit, but no effect. I want to output some exception detail in eunit test result. Thanks~

    Read the article

  • getting java.lang.OutOfMemoryError exception while running a Midlet (using netbeans)

    - by Jeeka
    I am writing a Midlet(using Netbeans) which reads a file containing exactly 2400 lines (each line being 32 characters long) and (extract a part of each line) puts them in an array. I am doing the same for 11 such files( all files have exactly 2400 lines).The Midlet runs fine for reading 6 files and putting them in 6 arrays. However, the Midlet stops while doing it for the 7th file throwing the following exception: TRACE: , startApp threw an Exception java.lang.OutOfMemoryError (stack trace incomplete) java.lang.OutOfMemoryError (stack trace incomplete) I have tried the modifying the netbeans.conf file to increase the heap memory ( as suggested by many forums and blogs) but nothing works for me. Here are the parameters that i had modified in the netbeans.conf file: -J-Xss2m -J-Xms1024m -J-Xmx1024m -J-XX:PermSize=1024m -J-XX:MaxPermSize=1536m -J-XX:+UseConcMarkSweepGC -J-XX:+CMSClassUnloadingEnabled -J-XX:+CMSPermGenSweepingEnabled Can anyone please help me to get me out of this ! I badly need this to be sorted out ASAP ! Thanks in advance !

    Read the article

  • Stack recommendations for small/medium-sized web application in Python

    - by reto
    I'm looking for some recommendations for a python web application. We have some memory restrictions and we try to keep it small and lean. We thought about using WSGI (and a python webserver) and build the rest ourself. We already have a template engine we'd like to use, but we are open for some suggestions regarding the whole request handling (the controller). The application has to run in a single process and the requests have to be processed with multiple threads. We've looked at django, but we are a not sure if it fits into our memory budget. Your feedback is very welcome! Cheers, Reto

    Read the article

  • CSS Experts required - problems with Z-Index stack in my page design

    - by Jack W-H
    Howdy y'all! Basically I'm having some problems with Z-Index. Although I'm not amazing at CSS I would reckon I was reasonably good, but really can't work this out. You'll see at the URL... http://howcode.com/code/ ... that my problem is that links in the returned 'Popular' results aren't clickable or anything. I've concluded this is due to their Z-Index being messed up. I had to fiddle and tweak with Z-Index to get the tabs - Popular, Top Rated, Featured etc. - to show above the codebg div. When I adjusted the Z-Index so that the results were definitely on top, they acted as normal - text could be selected, the ratings images hovered, etc. etc. However the downside to this was that my Popular, Top Rated, Featured tabs were all placed BENEATH the background image for the returned results. If anyone can post a workaround or alteration to my CSS that would be much appreciated. Please don't forget this is a test site and design and any other URLs are likely not to work, I haven't uploaded any database configs yet or whatever! Attached are a couple of screenshots to clarify what I mean: This is what I WANT to happen (not that in actual fact in this screenshots link aren't clickable, just to demo my point though): This is what DOES happen when I adjust the Z-Index properties (I don't want this!): Thanks y'all!

    Read the article

  • UIViewController is popped from view stack and NSURLConnection crashes the application

    - by rickharrison
    I am pushing a UIViewController onto a UINavigationController. This view controller immediately starts a download of an xml feed and then parses it. However, if you hit the back button before it is done downloading, and crashes with EXC_BAD_ACCESS. The line that is crashing it is in parserDidEndDocument and is this line: if (self.delegate && [self.delegate conformsToProtocol:@protocol(ModelDelegate)]) [self.delegate modelDidFinishParsing:self]; I assume it is crashing because it is trying to access self.delegate which is not assigned anymore. How do I get around this? Also, I would release the model object in the modelDidFinishParsing method. How would I release this model if it never reaches this method.

    Read the article

  • How to use traceit to report function input variables in stack trace

    - by reckoner
    Hi, I've been using the following code to trace the execution of my programs: import sys import linecache import random def traceit(frame, event, arg): if event == "line": lineno = frame.f_lineno filename = frame.f_globals["__file__"] if filename == "<stdin>": filename = "traceit.py" if (filename.endswith(".pyc") or filename.endswith(".pyo")): filename = filename[:-1] name = frame.f_globals["__name__"] line = linecache.getline(filename, lineno) print "%s:%s:%s: %s" % (name, lineno,frame.f_code.co_name , line.rstrip()) return traceit def main(): print "In main" for i in range(5): print i, random.randrange(0, 10) print "Done." sys.settrace(traceit) main() Using this code, or something like it, is it possible to report the values of certain function arguments? In other words, the above code tells me "which" functions were called and I would like to know "what" the corresponding values of the input variables for those function calls. Thanks in advance.

    Read the article

  • Why should pop() take an argument?

    - by Stephano
    Quick background I'm a Java developer who's been playing around with C++ in my free/bored time. Preface In C++, you often see pop taking an argument by reference: void pop(Item& removed); I understand that it is nice to "fill in" the parameter with what you removed. That totally makes sense to me. This way, the person who asked to remove the top item can have a look at what was removed. However, if I were to do this in Java, I'd do something like this: Item pop() throws StackException; This way, after the pop we return either: NULL as a result, an Item, or an exception would be thrown. My C++ text book shows me the example above, but I see plenty of stack implimentations taking no arguments (stl stack for example). The Qustion How should one implement the pop function in C++? The Bonus Why?

    Read the article

  • kernel get stack when signalled

    - by yoavstr
    hi there i write readers and writers where the kernel have to syncronize between them and block writer who already read a massage when i am in the queue waiting I get signal so I do the fallowing while (i_Allready_Read(myf) == ALLREADY_READ || isExistWriter == false ) //while (!(i_Allready_Read(aliveProc,current->pid))) { int i, is_sig = 0; printk(KERN_INFO "\n\n*****entered set in read ******\n\n" ); if (i_Allready_Read(myf) == ALLREADY_READ ) wait_event_interruptible (readWaitQ1, !i_Allready_Read(myf)); else wait_event_interruptible (readWaitQ1, isExistWriter); //printk(KERN_INFO "Read Wakeup %d\n",current->pid); for (i = 0; i < _NSIG_WORDS && !is_sig; i++) { is_sig = current->pending.signal.sig[i] & ~current->blocked.sig[i]; } if (is_sig) { handledClose(myf); module_put (THIS_MODULE); return -EINTR; } } return 0;//success } inline void handledClose(struct file *myf)//v { /* *if we close the writer other writer *would be able to enter to permissiones */ if (myf == writerpid ) { isExistWriter = DOESNT_EXIST; //printk(KERN_INFO "procfs_close : this is pid that just closed %d \n", writerpid); } /* *else its a reader so our numofreaders *need to decremented */ else { removeFromArr(myf); numOfReaders--; } } and my close does nothing ... what did i do wrong?

    Read the article

  • Getting source code information from groovy stack trace

    - by dotsid
    When exception generated I want to show some additional information (source code) for particular exception. But grails have very hairy exceptions (it's all about groovy dynamic nature). It's my problem where to get and how to display source code. All I need is file/line information. So... Is there any possibility to get file and line where exception were generated in grails/groovy?

    Read the article

  • How do I stack Plack authentication handlers?

    - by Schwern
    I would like to have my Plack app try several different means of authorizing the user. Specifically, check if the user is already authorized via a session cookie, then check for Digest authentication and then fall back to Basic. I figured I could just enable a bunch of Auth handlers in the order I wanted them to be checked (Session, Digest, Basic). Unfortunately, the way that Plack::Middleware::Auth::Digest and Plack::Middleware::Auth::Basic are written they both return 401 if digest or basic auth doesn't exist, respectively. How is this normally dealt with in Plack?

    Read the article

  • design function: underlying structure to store list of results for print to file

    - by forest.peterson
    is this a good approach to print a list of items to csv file with a sublist attached to each item. The gist of the function is when an item is found that does not exactly macth then a list of close matches is generated - this works now writing out one list at a time to a command window. For export to a csv file I think all the lists must be generated, stored and then written at once. Right now I use a struct to store the attributes printed, each struct is an item on the list - these structs are then added to a sorted stack and when printed they pop off into write out. Is a stack of stacks of structs a good design?

    Read the article

  • [C++] Needed: A simple C++ container (stack, linked list) that is thread-safe for writing

    - by conradlee
    I am writing a multi-threaded program using OpenMP in C++. At one point my program forks into many threads, each of which need to add "jobs" to some container that keeps track of all added jobs. Each job can just be a pointer to some object. Basically, I just need the add pointers to some container from several threads at the same time. Is there a simple solution that performs well? After some googling, I found that STL containers are not thread-safe. Some stackoverflow threads address this question, but none form a consensus on a simple solution.

    Read the article

  • Stack Info button above UIView in Utility App

    - by bgw
    I've started creating a iPhone Utility app (main view and flip view). I want to draw some graphics in the Main view, so I dragged a UIView object onto it. This works, but I find that if I resize the UIView to fill the Main view, it covers the Info button that invokes the Flip view. Is there any way to get the Info button to appear on top of the UIView? In IB? In code?

    Read the article

  • Does a servlet-based stack have significant overheads?

    - by John
    I don't know if it's simply because page-loads take a little time, or the way servlets have an abstraction framework above the 'bare metal' of HTTP, or just because of the "Enterprise" in Jave-EE, but in my head I have the notion that a servlet-based app is inherently adding overhead compared to a Java app which simply deals with sockets directly. Forget web-pages, imagine instead a Java server app where you send it a question over an HTTP request and it looks up an answer from memory and returns the answer in the response. You can easily write a Java socket-based app which does this, you can also do a servlet approach and get away from the "bare metal" of sockets. Is there any measurable performance impact to be expected implementing the same approach using Servlets rather than a custom socket-based HTTP listening app? And yes, I am hazy on the exact data sent in HTTP requests and I know it's a vague question. It's really about whether servlet implementations have lots of layers of indirection or anything else that would add up to a significant overhead per call, where by significant I mean maybe an additional 0.1s or more.

    Read the article

  • Loading a view routed by a URL parameter (e.g., /users/:id) in MEAN stack

    - by Matt Rowles
    I am having difficulties with trying to load a user by their id, for some reason my http.get call isn't hitting my controller. I get the following error in the browser console: TypeError: undefined is not a function at new <anonymous> (http://localhost:9000/scripts/controllers/users.js:10:8) Update I've fixed my code up as per comments below, but now my code just enters an infinite loop in the angular users controllers (see code below). I am using the Angular Express Generator for reference Backend - nodejs, express, mongo routes.js: // not sure if this is required, but have used it before? app.param('username', users.show); app.route('/api/users/:username') .get(users.show); controller.js: // This never gets hit exports.show = function (req, res, next, username) { User.findOne({ username: username }) .exec(function (err, user) { req.user = user; res.json(req.user || null); }); }; Frontend - angular app.js: $routeProvider .when('/users/:username', { templateUrl: function( params ){ return 'users/view/' + params.username; }, controller: 'UsersCtrl' }) services/user.js: angular.module('app') .factory('User', function ($resource) { return $resource('/api/users/:username', { username: '@username' }, { update: { method: 'PUT', params: {} }, get: { method: 'GET', params: { username:'username' } } }); }); controllers/users.js: angular.module('app') .controller('UsersCtrl', ['$scope', '$http', '$routeParams', '$route', 'User', function ($scope, $http, $routeParams, $route, User) { // this returns the error above $http.get( '/api/users/' + $routeParams.username ) .success(function( user ) { $scope.user = user; }) .error(function( err) { console.log( err ); }); }]); If it helps, I'm using this setup

    Read the article

< Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >