User Profile
Collapse
-
yes, sorry, I was thinking java when I wrote that. Thanks! -
-
Python circular class inclusion
Suppose I have a class setup like this:
How can I make this work, preferably in one file?Code:class Foo: Bar b class Bar: Foo f -
Making an OLE object
How would I go about making an custom OLE object that, say, contains an image with some text attached? I looked at msdn but the documentation is unhelpful and confusing. I know I have to implement IOleObject, but is there a tutorial or something? -
You probably want to look into ShellExecute as well.
http://msdn2.microsoft .com/en-us/library/bb762153.aspxLeave a comment:
-
Since you are using pointers and pointer referencing (it looks like C++) you will need to explicitly tell the compiler to allow unsafe code. You will also need to declare the functions unsafe.Leave a comment:
-
You shouldn't calculate the factorial for every term in the series. Think about what is happening --- you are dividing first by 1!, then 3!, then 5!. They differ by only 2 multiplications . Keep a running total of what the denominator should be instead.Leave a comment:
-
-
Hmm, thanks for the help, but it seems that this solution breaks when it encounters 0x80000000 - instead of returning itself, it returns 0! Most likely since it relies on the fact that (x ^(x-1) + 1 will place the LSB one 'place' up and then shifts it back down; MIN_INT ^ (MIN_INT - 1) results in -1 and adding one makes that 0...
Edit: Ok, i figured out a better way once i worked through why your algotithm works and breaks for MIN_INT...Leave a comment:
-
least significant set bit
Hello,
I'm trying to find the least significant set bit (i.e. the first '1' bit in an int) through just bit twiddling, but I can't get it without resorting to a loop. My original idea was to reverse the bits in an int and find the most significant bit then subtract it from 31 to get the position of the LSB. Is there a way to get the LSB of an int using just bit manipulations?
e.g., 0b0101 would return 0001,
...
No activity results to display
Show More
Leave a comment: