User Profile

Collapse

Profile Sidebar

Collapse
thegeneralguy
thegeneralguy
Last Activity: Sep 14 '08, 07:24 PM
Joined: Aug 13 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • thegeneralguy
    replied to Python circular class inclusion
    yes, sorry, I was thinking java when I wrote that. Thanks!
    See more | Go to post

    Leave a comment:


  • thegeneralguy
    replied to Python circular class inclusion
    yes, sorry, I was thinking java when I wrote that. Thanks!
    See more | Go to post

    Leave a comment:


  • thegeneralguy
    started a topic Python circular class inclusion

    Python circular class inclusion

    Suppose I have a class setup like this:

    Code:
    class Foo:
          Bar b
    class Bar:
          Foo f
    How can I make this work, preferably in one file?
    See more | Go to post

  • thegeneralguy
    started a topic Making an OLE object
    in C

    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?
    See more | Go to post

  • thegeneralguy
    replied to Execute *.exe file using c++
    in C
    You probably want to look into ShellExecute as well.
    http://msdn2.microsoft .com/en-us/library/bb762153.aspx
    See more | Go to post

    Leave a comment:


  • thegeneralguy
    replied to CRC 16 implementation in c#
    in .NET
    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.
    See more | Go to post

    Leave a comment:


  • thegeneralguy
    replied to Sine Caculation/Approximation Problem?
    in C
    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.
    See more | Go to post

    Leave a comment:


  • thegeneralguy
    replied to least significant set bit
    in C
    (x & -x) which is equivalent to (x & (~x + 1))...
    See more | Go to post

    Leave a comment:


  • thegeneralguy
    replied to least significant set bit
    in C
    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...
    See more | Go to post

    Leave a comment:


  • thegeneralguy
    started a topic least significant set bit
    in C

    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,
    ...
    See more | Go to post
No activity results to display
Show More
Working...