Search:

Type: Posts; User: flp1969

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    6
    Views
    133

    Here's a small example using SDL2: // sdl.c...

    Here's a small example using SDL2:

    // sdl.c
    //
    // $ cc -O2 `pkg-config --cflags sdl2 SDL2_image` \
    // -o sdl sdl.c \
    // `pkg-config --libs sdl2 SDL2_image`
    //
    #include...
  2. Replies
    6
    Views
    133

    If you want the image to fill the entire window,...

    If you want the image to fill the entire window, you have some options: Get the maximized Window width and height and resize the image object accordingly... Notice if your image have a different...
  3. Replies
    6
    Views
    133

    Here: // test.c // Tested with: // // $ cc...

    Here:

    // test.c
    // Tested with:
    //
    // $ cc -O2 `pkg-config --cflags gtk+-3.0` \
    // -o test test.c \
    // `pkg-config --libs gtk+-3.0`
    // $ ./test pic.jpg
    //
  4. Replies
    6
    Views
    133

    Did you try to add a call to...

    Did you try to add a call to gtk_window_maximize() between lines 14 and 15 (or at line 21, before showing the window)?
  5. Replies
    9
    Views
    138

    /proc/[pid]/mem requires PTRACE permissions, as...

    /proc/[pid]/mem requires PTRACE permissions, as told in the manpage:



    /proc/[pid]/mem
    This file can be used to access the pages of a process's memory through
    ...
  6. Replies
    9
    Views
    138

    "pear shaped"? When creating directories, the...

    "pear shaped"?

    When creating directories, the 'x' permission have a different meaning than for files: They mean 'search', meaning if you don't set this permission, you'll not be able to 'search'...
  7. Replies
    30
    Views
    369

    There is no 'exename', but there is a 'comm': ...

    There is no 'exename', but there is a 'comm':

    15962

    Just the executable name...
  8. Replies
    30
    Views
    369

    Since you want to allocate the right amount of...

    Since you want to allocate the right amount of memory to read the "executable" name, you do know scanf() can allocate the buffer dynamically, don't ya?

    #include <stdio.h>
    #include <stdlib.h>...
  9. Replies
    30
    Views
    369

    I really didn't understand what you really want....

    I really didn't understand what you really want.
    Take a look at procfs manpage to see what /proc/[pid]/stat offer. Maybe you want something like /proc/[pid]/statm (notice the 'm' at the end).
    BTW:...
  10. Replies
    5
    Views
    160

    Network Time Protocol (NTP)

    Network Time Protocol (NTP)
  11. First: Read the INSTALL file... Check what...

    First: Read the INSTALL file...

    Check what header file declares the function in INCLUDE_DIR
    Check which library to use in LIB_DIR
  12. Replies
    8
    Views
    242

    Wow... I didn't notice the '0xAA' (between single...

    Wow... I didn't notice the '0xAA' (between single quotes)... :)
  13. Yep... I've heard about antique systems with 9...

    Yep... I've heard about antique systems with 9 bit bytes and 36 bits word size! (PDP-7?) :)
  14. Thank you! This is very useful! []s Fred

    Thank you! This is very useful!

    []s
    Fred
  15. You are right: __builtin_clzll() and it is not...

    You are right: __builtin_clzll() and it is not portable... and I forgot sizeof returns the number of bytes, so I need to multiply sizeof( size_t ) by 8 as well... :)

    There is a small confusion...
  16. A small correction on Post #5: ......

    A small correction on Post #5:


    ...
    new_capacity = 1ULL << ( 8 * sizeof ( size_t ) - __builtin_clz( needed ) - 1);
    ...
  17. An warning: Don't do this: nodes = realloc(...

    An warning: Don't do this:

    nodes = realloc( nodes, *capacity * sizeof( Node ) );
    reallod() can fail (returning NULL). In that case, you'll loose the address contained in nodes pointer and get a...
  18. Replies
    72
    Views
    853

    Why not keep this simple. You are not, obviously,...

    Why not keep this simple. You are not, obviously, interested in a cryptographically secure RNG, so LCG, Mersene Twister, Xorshift128 or any other PRNG is suitable. A thread safe LCG is easy enough to...
  19. Replies
    8
    Views
    242

    0xA0 isn't ASCII or a valid UTF-8 char. In...

    0xA0 isn't ASCII or a valid UTF-8 char. In ISO-8859-1 (Latin1) or WINDOWS-1252 is a "non breaking space"...
    The printed char depends on your encoding... Example... if you do:

    ...
  20. Replies
    72
    Views
    853

    What suprises me is that you are dealing with...

    What suprises me is that you are dealing with mathematical problems (floating point, random numbers), but refuse to learn the proper mathematics...
  21. Replies
    72
    Views
    853

    Good books about random number generators: Luc...

    Good books about random number generators:

    Luc Devroye - Non Uniform Random Variates

    and, of course, volume 2 of the art of computer programming by Donald E. Knuth

    Donald E. Knuth - The Art...
  22. Replies
    72
    Views
    853

    Compare this to the "noise" you get with the LCG...

    Compare this to the "noise" you get with the LCG (rand)... You'll notice yours has some "regular" spots (not as random as it should be)...

    As I said... this is better than before, but rand() is...
  23. Replies
    72
    Views
    853

    Why "miss"? Example code to use RDRAND if...

    Why "miss"? Example code to use RDRAND if available and to make sure will always return a random valid value:

    #include <stdio.h>
    #include <stdlib.h>
    #include <stdint.h>

    /* Test if RDRAND is...
  24. Replies
    72
    Views
    853

    One more reason to check if your processor...

    One more reason to check if your processor supports RDRAND (AMD FX, maybe not!)... I recomend you do the same I did before: Declare 2 pointers to functions and initialize them after calling an "init"...
  25. Replies
    72
    Views
    853

    Ahhh... BTW... if your processor uses Big Endian,...

    Ahhh... BTW... if your processor uses Big Endian, I think it must be wise to do something like this. PPM format expects RR GG BB in that order:


    ...
    int t;
    val = t = rand2rgb( func() );

    #if...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4