Search:

Type: Posts; User: Compyx; Keyword(s):

Page 1 of 10 1 2 3 4

Search: Search took 0.11 seconds.

  1. Replies
    6
    Views
    542

    Re: Question about a makefile

    The brute-force solution is to issue:

    make -B
    This will rebuild all targets, regardless of timestamps.

    Ofcourse, this will get very annoying/timeconsuming when working on large projects, so a...
  2. Replies
    21
    Views
    5,497

    Re: Convert number to Binary? in C

    Your 'highest bit' code doesn't do what you meant it to do; you left out CHAR_BIT:


    result = value >> (sizeof(unsigned int) * CHAR_BIT - 1);


    The sizeof operator yields the size of its...
  3. Replies
    15
    Views
    819

    Re: issapce problem in this snippet

    Never, ever use gets(), use fgets():


    fgets(s, 100, stdin);


    Also note the only portable values to return from main are 0, EXIT_SUCCESS and EXIT_FAILURE.
  4. Replies
    4
    Views
    658

    Re: Baisc JavaScript Form Validation Help

    What you should do is remove onclick="validate();" from the submit button, and add onsubmit="validate();" to the <form> tag.
    And the validate() function should look something like this:

    ...
  5. Replies
    4
    Views
    658

    Re: Baisc JavaScript Form Validation Help

    There's not a lot of context to determine what could be wrong, but I'll give it a shot.

    Normally when doing client-side form validation with Javascript, you use the 'onsubmit' event of the form to...
  6. Re: Python: Generator object has no attribut __next__()

    The method is called 'next', no leading or trailing underscores.
  7. Replies
    2
    Views
    5,641

    Re: Prototype function definition

    That's were the error is occuring, like the message said, old-style (pre-ANSI) parameter declarations mixed with prototyped (ANSI) function definition.
    Two quick solutions here: either remove the...
  8. Replies
    2
    Views
    779

    Re: Mysqli problems....

    I have used both, and I prefer the newer mysqli over mysql. Mysqli allows for an OO approach to querying databases, which leads to cleaner code (IMHO). That said, these days I prefer to use PEAR's...
  9. Replies
    3
    Views
    2,693

    Re: Memory use after bash for loop

    But it isn't really a leak, the memory is freed by bash when bash exits. Of course, it would make sense to free the memory used by a loop after the loop has finished, but there may be reasons why the...
  10. Replies
    3
    Views
    2,693

    Re: Memory use after bash for loop

    This issue has been reported on launchpad: https://bugs.launchpad.net/ubuntu/+source/bash/+bug/82123. It seems the bash maintainers don't see this as a problem, so I don't expect this will get fixed...
  11. Replies
    2
    Views
    286

    [SOLVED] Re: Deal with files with spaces in their names

    You can tell find and xargs to use '\0' to delimit filenames, rather than whitespace. Find needs the option '-print0' and xargs needs the option '--null'.

    Example:


    find /usr/src -name *.c...
  12. Replies
    9
    Views
    9,028

    Re: Implementing BBcode

    +1

    Although a simple BBcode parser isn't that hard to write, there are still a lot of pitfalls, such as users embedding html code in their posts (which needs to be filtered out), and...
  13. Replies
    5
    Views
    1,599

    Re: Simple C for loop question.

    Don't rely on that. In a boolean context, NULL is indeed false, but NULL isn't always all-bits zero. A implementation is allowed to, for example, declare NULL as (void*)0xDEADBEEF.

    A '0' numeric...
  14. Replies
    7
    Views
    1,272

    Re: Good BASH Tutorial

    Thanks for taking the time to explain your views. The abs guide is indeed very inconsistent in its examples, perhaps because many people contributed code snippets. (it should be the authors job to...
  15. Replies
    7
    Views
    1,272

    Re: Good BASH Tutorial

    Any particular reasons for this? I know it tends to experiment a lot and isn't very clearly written, but I found it to be quite useful as a reference. It does often fail to mention portability...
  16. Re: How should I lay out doxygen documentation?

    Doxygen expects a documentation block to belong to whatever comes after it, so the documentation goes before the function definition. There are exceptions though: preprocessor conditionals. Doxygen...
  17. Replies
    7
    Views
    1,272

    Re: Good BASH Tutorial

    http://tldp.org/LDP/abs/html/
  18. Replies
    1
    Views
    1,386

    Re: mysql date default to todays date

    MySQL doesn't support function calls as default values, only constants. However, for this particular problem, you can change the field type to 'TIMESTAMP':



    create table users(
    -> id int...
  19. Replies
    14
    Views
    7,444

    Re: Reverse strstr() ?

    I was playing with the same idea, would work fine for just a few searches on smallish strings. But it would add a lot of overhead for large strings with a lot of searches.

    A good example of 'When...
  20. Re: bash script to iterate through files and add a line

    As tomazzi already mentioned, sed has the -i/--in-place option:



    for f in * ; do
    sed -i '1s/^/Subject:Your Daily Book Part, Tarah.\n/' "$f"
    cat "$f"
    done
  21. Replies
    8
    Views
    623

    Re: Backend DB first, then user interface?

    I would also recommend designing the database first, once the database back-end is set up properly, the front-end tends to write itself since the database design dictates the design of the front-end....
  22. Replies
    35
    Views
    1,584

    Re: C: pass-by-reference vs. passing a pointer

    Since void is an incomplete type, applying the sizeof operator to void is a constraint violation, which requires a diagnostic. At least that's what I make of it, though I'm not that well versed in...
  23. Replies
    35
    Views
    1,584

    Re: C: pass-by-reference vs. passing a pointer

    I assume you mean unsigned char *, which is close to the generic pointer type pre-ANSI, which was char *.
  24. Thread: awk & sed

    by Compyx
    Replies
    4
    Views
    379

    Re: awk & sed

    It depends on what you want. As far as I know Awk doesn't have any built-in statistical analysis tools/functions, but since Awk is a full-fledged programming language with support for floating point...
  25. Thread: awk & sed

    by Compyx
    Replies
    4
    Views
    379

    Re: awk & sed

    This sed command:


    sed -i 's/foo/bar/g' SOMEFILE

    can be implemented in awk like this:


    awk '{ gsub(/foo/, "bar", $0); print }' SOMEFILE
Results 1 to 25 of 250
Page 1 of 10 1 2 3 4