Search Results

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

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

  • Using logarithms to normalize a vector to avoid overflow

    - by muscicapa
    http://stackoverflow.com/questions/2293762/problem-with-arithmetic-using-logarithms-to-avoid-numerical-underflow-take-2 Having seen the above and having seen softmax normalization I was trying to normalize a vector while avoiding overflow - that is (x1 x2 x3 x4 ... xn) the normalized form for me has the sum of squares as 1.0 So what I thought of doing is s=(2*log(x1)+2*log(x2)+...+2*log(xn))/2 so the two factor can be taken off and finally the normalized vector is exp(log(x1)-s), , ..., exp(log(xn)-s) but I am evidently doing something wrong here, what?

    Read the article

  • Stack Overflows in the Eclipse JSP Editor

    - by stevedbrown
    When editing JSPs in Eclipse, I periodically get stack overflows. Once I get one, each time I click a character I get a pop-up telling me there was another stack overflow. This continues until I close the JSP and re-open it, at which time it's fine for a while. org.eclipse.jst.jsp.core.internal.parser.JSPSourceParser: input could not be parsed correctly at position 1 java.lang.StackOverflowError Has anyone else seen this issue, do you know the cause, and is there a way to fix it?

    Read the article

  • Best way to handle Integer overflow in C#?

    - by byte
    Handling integer overflow is a common task, but what's the best way to handle it in C#? Is there some syntactic sugar to make it simpler than with other languages? Or is this really the best way? int x = foo(); int test = x * common; if(test / common != x) Console.WriteLine("oh noes!"); else Console.WriteLine("safe!");

    Read the article

  • Div overflow not hidden properly

    - by bbeckford
    Hi guys, I'm working on this site - http://dev.chriscurddesign.co.uk/mayday It works in everything other than IE7 and IE8 in compatibility mode (don't care about IE6), where the vacancies lists on the right aren't hidden correctly by their parent overflow property. I have been pulling my hair out trying to get to the bottom of this, its driving me up the wall, anyone got any ideas whatsoever? Below is an image of the issue, chrome on the left, IE8 compat mode on the right. Cheers, -Ben

    Read the article

  • Stack Overflow Exploit in C

    - by Fernando Gonzalez
    Hey there guys, the question is actually about stack overflows in C. I have an assigment that I can not get done for the life of me, i've looked at everything in the gdb and I just cant figure it. The question is the following: int i,n; void confused() { printf("who called me"); exit(0); } void shell_call(char *c) { printf(" ***Now calling \"%s\" shell command *** \n",c); system(c); exit(0); } void victim_func() { int a[4]; printf("[8]:%x\n", &a[8]); printf("Enter n: "); scanf("%d",&n); printf("Enter %d HEX Values \n",n); for(i=0;i<n;i++) scanf("%x",&a[i]); printf("Done reading junk numbers\n"); } int main() { printf("ls=736c --- ps = 7370 --- cal = 6c6163\n"); printf("location of confused %x \n", confused); printf("location of shell_call %x \n", shell_call); victim_func(); printf("Done, thank you\n"); } Ok, so I managed to get the first question correctly, which is to arbitrarily call one of the two functions not explicitly called in the main path. By the way, this has to be done while running the program without any modifications. I did this by running the program, setting N to 7, which gets me to the Function Pointer of the victim_func frame, I write a[7] with the memory address of confused or shell_call, and it works. (I have a 64 bit machine, thats why I have to get it to 7, since the EBI pointer is 2 ints wide, instead of 1) My question is the following, how could I control which argument gets passed to the shell_code funcion? ie. how do i write a string to char* c. The whole point is executing unix commands like "ps" etc, by running only the program. I figured writing the EBI pointer with the hex representation of "ps" and setting the arg list of shell_call to that, but that didn't work. I also tried inputing argsv arguments and setting the arg list of shell_call to the arg_list of main, but didnt work either. I think the second version should work, but i believe im not setting the arg list of the new stack frame correctly ( I did it by writing a[8] to 0, since its the first part of the functin pointer, and writing a[9]=736c and a[10]=0000, but its probably not right since those are the parameters of victim_func. So how do i access the parameters of shell_call?

    Read the article

  • Integer Overflow in VBA project

    - by mcoolbeth
    Hi, everyone. Here is a small VBA (Excel) function that i wrote, full of MsgBoxes for debugging. I am passing in the numbers 10 and 1 as arguments, and getting an overflow error when the program reaches the top of the For loop, before it begins the first iteration. Any thoughts are appreciated. Function PerformanceTest(iterations As Integer, interval As Integer) As Double Dim st, tot, k As Double Dim n As Integer tot = 0# MsgBox "ok" k = iterations + tot MsgBox "ookk" n = 1 MsgBox "assigned" For n = 1 To iterations MsgBox n st = Timer Application.Calculate tot = tot + (Timer - st) Sleep (1000 * interval) Next n 'MsgBox (tot / k) PerformancTest = tot / k End Function

    Read the article

  • Java - sorted stack

    - by msr
    Hello, I need a sorted stack. I mean, the element removed from the stack must be the one with great priority. Stack dimension varies a lot (becomes bigger very fast). I need also to search elements in that stack. Does Java give some good implementation for this? What class or algorithm do you suggest for this? I'm using a PriorityQueue right now which I consider reasonable except for searching, so Im wondering if I can use something better. Thanks in advance!

    Read the article

  • Passing paramenters on the stack

    - by oxinabox.ucc.asn.au
    When you pass parameters to a function on the cpu stack, You put the parameters on then JSR puts the return address on the stack. So than means in your function you must take the top item of the stack (the return address) before you can take the others off) eg is the following the correct way to go about it: ... |Let’s do some addition with a function, MOVE.L #4, -(SP) MOVE.L #5, -(SP) JSR add |the result of the addition (4+5) is in D0 (9) ... add: MOVE.L (SP)+, A1 |store the return address |in a register MOVE.L D0, -(SP) |get 1st parameter, put in D0 MOVE.L D2, -(SP) |get 2nd parameter, put in D0 ADD.L D2, D0 |add them, |storing the result in D0 MOVE.L A1, -(SP) |put the address back on the |Stack RTS |return

    Read the article

  • Passing parameters on the stack

    - by oxinabox.ucc.asn.au
    When you pass parameters to a function on the cpu stack, You put the parameters on then JSR puts the return address on the stack. So that means in your function you must take the top item of the stack (the return address) before you can take the others off) eg is the following the correct way to go about it: ... |Let’s do some addition with a function, MOVE.L #4, -(SP) MOVE.L #5, -(SP) JSR add |the result of the addition (4+5) is in D0 (9) ... add: MOVE.L (SP)+, A1 |store the return address |in a register MOVE.L (SP)+, D0 |get 1st parameter, put in D0 MOVE.L (SP)+, D2 |get 2nd parameter, put in D2 ADD.L D2, D0 |add them, |storing the result in D0 MOVE.L A1, -(SP) |put the address back on the |Stack RTS |return

    Read the article

  • How to make Stack.Pop threadsafe

    - by user260197
    I am using the BlockingQueue code posted in this question, but realized I needed to use a Stack instead of a Queue given how my program runs. I converted it to use a Stack and renamed the class as needed. For performance I removed locking in Push, since my producer code is single threaded. My problem is how can thread working on the (now) thread safe Stack know when it is empty. Even if I add another thread safe wrapper around Count that locks on the underlying collection like Push and Pop do, I still run into the race condition that access Count and then Pop are not atomic. Possible solutions as I see them (which is preferred and am I missing any that would work better?): Consumer threads catch the InvalidOperationException thrown by Pop(). Pop() return a nullptr when _stack-Count == 0, however C++-CLI does not have the default() operator ala C#. Pop() returns a boolean and uses an output parameter to return the popped element. Here is the code I am using right now: generic <typename T> public ref class ThreadSafeStack { public: ThreadSafeStack() { _stack = gcnew Collections::Generic::Stack<T>(); } public: void Push(T element) { _stack->Push(element); } T Pop(void) { System::Threading::Monitor::Enter(_stack); try { return _stack->Pop(); } finally { System::Threading::Monitor::Exit(_stack); } } public: property int Count { int get(void) { System::Threading::Monitor::Enter(_stack); try { return _stack->Count; } finally { System::Threading::Monitor::Exit(_stack); } } } private: Collections::Generic::Stack<T> ^_stack; };

    Read the article

  • problem when trying to empty a stack in c

    - by frx08
    Hi all, (probably it's a stupid thing but) I have a problem with a stack implementation in C language, when I try to empty it, the function to empty the stack does an infinite loop.. the top of the stack is never null. where I commit an error? thanks bye! #include <stdio.h> #include <stdlib.h> typedef struct stack{ size_t a; struct stack *next; } stackPos; typedef stackPos *ptr; void push(ptr *top, size_t a){ ptr temp; temp = malloc(sizeof(stackPos)); temp->a = a; temp->next = *top; *top = temp; } void freeStack(ptr *top){ ptr temp = *top; while(*top!=NULL){ //the program does an infinite loop *top = temp->next; free(temp); } } int main(){ ptr top = NULL; push(&top, 4); push(&top, 8); //down here the problem freeStack(&top); return 0; }

    Read the article

  • Total stack sizes of threads in one process

    - by David
    I use pthreads_attr_getthreadsizes() to get default stack size of one thread, 8MB on my machine. But when I create 8 threads and allocate a very large stack size to them, say hundreds of MB, the program crash. So, I guess, shall ("Number of threads" x "stack size of per thread") shall less than a value(virtual memory size)?

    Read the article

  • Highlighting company name in Eclipse stack traces

    - by Robin Green
    Is there a way to make Eclipse highlight com.company (where for company substitute the name of the company you work for) in stack traces? It would make it fractionally easier and faster to home in on which parts of the stack trace were ours, and which were third-party code. I tried the logview plugin here, and while it does work, it makes the location information in the stack traces unclickable, which means I would waste more time than I would save.

    Read the article

  • Should a Stack have a maximum size?

    - by Sotirios Delimanolis
    I'm practicing my knowledge of ADTs by implementing some data structures, even if most already exist. With Stacks, a lot of books and other documentation I've read talk about the stack throwing an error when you try to add an element but the stack is full. In a java implementation (or any other), should I specifically keep track of a maximum stack size (from constructor), check to see if that size is reached, and throw an overflow exception if it is? Or is not such a big deal?

    Read the article

  • Overflow on UILabels

    - by jkeesh
    I have a table view that I am customizing and I am adding a UILabel as a subview of the contentView, and I want the number of lines to be relatively consistent. I set the numberOfLines property to be 3 so it can't go more than that, but there are still some that overflow onto the 4th line. If it overflows, I want to add a a trailing ... How can I figure out if it overflows? I've tried truncating at different character counts of my string, but since I am using lineBreakMode = UILineBreakModeWordWrap the number of characters doesn't really predict the number of lines. Is there a way to find out the number of lines your UILabel is using?

    Read the article

  • Making a vertically scrolling parent div which does not cause overflow of children

    - by marq
    I have something as follows: <div style="float: left; height: 20px; overflow-y: scroll"> <div>hello this is a test</div> <div>hello this is another test</div> <div>t1</div> <div>t2</div> <div>t3</div> </div> The parent div grows to the appropriate width to fit the largest child (which is what I want). However, the vertical scrollbar causes the inner width to be smaller, which causes the largest child to wrap. Is there a way to get the parent to grow to the width of the largest child + the width of the scroll bar? I've tried every margin trick I know, but nothing.

    Read the article

  • Brainfart: How to make overflow content in a div

    - by Conor
    I cant even come up with a proper subject for this one... Basically I have a box div, that when click expands to a rectangle and shows content in the new expanded area. The problem I'm having is that when I animate out the div's width, the browser wants to render the content as the box is stretching, rather than just have it placed where I need it. Initial State ____ | | |____| Clicked _________________ | Content | |_________________| How it currently renders __________ | Con | |______tent| How I want it to render: __________ | Cont|ent (overflow:hidden) |__________| Someone help me out here... total brainfart.

    Read the article

  • How to detect an overflow in C++ ?

    - by Tim
    Hi, I just wonder if there is some convenient way to detect if overflow happens to any variable of any default data type used in a C++ program during runtime? By convenient, I mean no need to write code to follow each variable if it is in the range of its data type every time its value changes. Or if it is impossible to achieve this, how would you do? For example, float f1=FLT_MAX+1; cout << f1 << endl; doesn't give any error or warning in either compilation with "gcc -W -Wall" or running. Thanks and regards!

    Read the article

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