CSS image scaling to fit within area not distort

You should try using this: img{ width: auto; max-width: 150px; height: auto; max-height: 100px; } Edit: Looks like IE6 doesn’t support max-width and max-height properties. However, you can implement the workaround given here: max-width, max-height for IE6 Excerpt (in case linked article stops working): img { max-height: 100px; max-width: 100px; width: expression(document.body.clientWidth > 150? “150px”: … Read more

Why does this behave the way it does with max-width: 0?

Note: It’s not just max-width:0, it’s any width less than the text content’s width. The mixture of display: table-cell, max-width, and width:100% make an interesting situation that the specifications don’t explicitly cover. However, by making some observations and thinking, we can understand why we have the same behavior across all major browsers. max-width:0 tries to … Read more

How to detect possible / potential stack overflow problems in a c / c++ program?

On Windows a stack overflow exception will be generated. The following windows code illustrates this: #include <stdio.h> #include <windows.h> void StackOverFlow() { CONTEXT context; // we are interested control registers context.ContextFlags = CONTEXT_CONTROL; // get the details GetThreadContext(GetCurrentThread(), &context); // print the stack pointer printf(“Esp: %X\n”, context.Esp); // this will eventually overflow the stack StackOverFlow(); … Read more

OverflowError: long int too large to convert to float in python

Factorials get large real fast: >>> math.factorial(170) 7257415615307998967396728211129263114716991681296451376543577798900561843401706157852350749242617459511490991237838520776666022565442753025328900773207510902400430280058295603966612599658257104398558294257568966313439612262571094946806711205568880457193340212661452800000000000000000000000000000000000000000L Note the L; the factorial of 170 is still convertable to a float: >>> float(math.factorial(170)) 7.257415615307999e+306 but the next factorial is too large: >>> float(math.factorial(171)) Traceback (most recent call last): File “<stdin>”, line 1, in <module> OverflowError: long int too large to convert to float You could … Read more

tech