jephthah 1,888 Posting Maven

god that's horrible.

jephthah 1,888 Posting Maven

The only difference I can see is, if you use the second method you have to open and update the header.h file whenever you need a new libraries functionality..The first method, just add the include at the top of the file no updating a header file.

i can't imagine why you would ever need a completely new library in your otherwise static code.... and even if you did, how would it be better to have to change the source code rather than the header file? in either case you will still have to recompile and redistribute a new version


My preference is to include header files where they are needed. If you need to functionality of stdio.h in your header (i.e you need to use FILE ) the include it otherwise it is just noise.

obviously. I only include library headers that are needed. "source.c" includes "source.h", which itself contains all the #defines, typedefs, #includes, etc. that "source.c" needs.

what i'm asking here is what is the "Best Practices" for including header files? is there a real reason why you should not put the #include statements in the header .H file? Or, at least, is there some reason why it's better to put your #includes in the source .C file?

thanks

jonsca commented: Welcome back +7
jephthah 1,888 Posting Maven

oh, scorpio. that's hot.

jephthah 1,888 Posting Maven

ah, okay. i'm glad i didnt spend any time searching the standard libraries. :-)

jephthah 1,888 Posting Maven

no offence. i'm a student and that all i can afford

that's why we HELP for FREE.

don't you have some sort of academic integrity policy at your school? I'm sure paying for homework is in violation of that.

i just turned in someone to their engineering dean and course professor for this.

jephthah 1,888 Posting Maven

you can also send complaints to me.

I run this place.

jephthah 1,888 Posting Maven

Narue >> That quoting method is worse than awful. Pick one method and stick to it, don't combine them.


okay, fine. I like the concept of quote tags, and i like the boxed out separation, but the font face makes me ill.

so i'll go back to the old newsgroup variation.

jephthah 1,888 Posting Maven

or maybe, i'm right outside your window

(*ducks*)

jephthah 1,888 Posting Maven

wait, wait.... you want me to....

download Turbo C and install it on my 21st Century machine, just so I can ... compile some broken-down code that won't work anyhow?

lol! :D


now, seriously. you need to wheel that trash on out of here. Take it home and fix it up. bring us back a C program that can ACTUALLY COMPILE, not some bastardized C/C++ hybrid, and none of these deprecated libraries from 1989.

Then and only then will i bother to compile it and verify it is indeed still broken, anyhow. and then you can go donate $20 to some charity.

otherwise, GTFO.

jephthah 1,888 Posting Maven

Look. here's your first hint. you do NOT reinstall your OS every time something difficult or confusing occurs.

i mean, seriously, just THINK about that.

now did you write the file1.c to the directory in the first place? what happens when you try to do it again? any warnings?

is your directory write-protected? find a file in that directory and "touch" it. any warnings?

do an "ls -l" command on the directory itself to see the owner and group permissions. use "chown" or "chmod", respectively, to change them if they're not what they should be. use the "su" or "sudo" command if you need to increase your own permission to do so.

.

jephthah 1,888 Posting Maven

Hey, now, you two go get a room already.

Aia commented: Here! For the good nature. +8
jephthah 1,888 Posting Maven

well... congrats!

iamthwee commented: Do I detect an air of sarcasm young man? +0
jephthah 1,888 Posting Maven

strsep is good, but not portable to WIN32 compilers.

http://www.gnu.org/s/libc/manual/html_node/Finding-Tokens-in-a-String.html

0x69 commented: agree, too specific means too bad :) +1
jephthah 1,888 Posting Maven

but how do i use google in C?

jephthah 1,888 Posting Maven

i too was wondering that. and where does *i and *j get allocated.

but I'm also kind of afraid to ask. may be best to leave well enough alone.

jephthah 1,888 Posting Maven

...

>> "the designer" .... you mean it's not you ?
>> who is this person? give us their name!

...

> http://jess3.com

so we discover this new website design was developed by some "Jess3".

I don't know anything about this developer, but it's funny how their own homepage looks like a mishmash of crap all slapped together at the last minute, in one big long run-on stream with hardly a concern ot organization or presentation....

I mean, if was going to present my web designs, as a web design company, I think I might want to spend a little bit of time organizing my own portfolio in a halfway coherent manner. I don't know... maybe just a little bit.


well, anyhow im relieved that this was a third party developer. because i thought it was Dani's personal backyard project where she got a couple buddies and hauled the engine block out with a pulley hooked to an old oak tree ... i felt bad about ragging the design so much, that she would take it personal.

but i'm also surprised that this is a third party professional developer.

because it's damn near unreadable and almost makes my eyes bleed.

well with the new facts revealed here's my suggestion: put a stop payment on the check and file breach of contract. it seems obvious they put some vision-impaired intern on this project.

there's just no …

colweb commented: Well spoken +0
diafol commented: Have to agree with you on Jess3 - piss poor +0
jephthah 1,888 Posting Maven

aha. well, internet memes force us all to read "azn" these days.

tho i admit, the "cok" didn't quite fit. It's only because i'm infatuated with a user named "Coke Dude". I'm his secret stalker :P

jonsca commented: ...forget it, I'm not gonna go near that one. +4
jephthah 1,888 Posting Maven

"Boys Make Sh--" ? Is that really your name?

well you certainly did make us some shit, didn't you boy? a real horrible steaming pile of it, and dropped it right on our shiny floor. oh look, you named it with a .CPP extention, too.

I'll bet you $20 it doesn't even work.


.

tux4life commented: Marvelous answer :) +8
jephthah 1,888 Posting Maven

Whenever possible, try to avoid nested loop as they have a worst-case of O(n2) - Big O n square.

the criticism you give is meaningful only for extremely large loops or realtime embedded applications such as scientific instrumentation and measurement.

for small to average sized loops -- the vast majority of cases in a help forum -- the time hit is inconsequential, and nested loops are often the simplest and most direct solution.

He's playing a dice game, for the gods' sake. we don't need a junior-level CSC optimization lecture. :icon_rolleyes:

iamthwee commented: I cried when I read this, even a little wee came out. +11
jephthah 1,888 Posting Maven

or maybe i'm just a drama queen and wanted to see who loves me?

oh well, so much for my hiatus. i see some incremental changes being made that make the new site more tolerable.

and, when i think about it.... where else can i get instant gratification and social rewards for abusing silly people?

jephthah 1,888 Posting Maven

You know, i don't consider myself old. I don't have vision problems. but when i look at this site now, generally speaking, i find it very difficult to read.

Oh, the buttons and headers and footers and advertising banners and other assorted tags are quite large and prominently displayed. i can read them just fine. and yeah, they load up faster, i suppose.

but as for the textual content? the very reason i actually come here? well now i've gotta freakin' squint and move closer to the screen.

sure i could roll my zoom button and magnify the entire page. but that makes it even more unpleasant.

and that's what it really comes down to. this new layout, this lack of usability, is downright unpleasant.

i'm not even talking about the garish color. If it was just that, I could accept it as someone else's personal taste. not mine, but hey whatever.

Im talking about the general difficulty in navigating around between threads and forums, and the specific unreadability of the tiny light content text in striking conflict with the huge monochromatic site framework and incomprehensibly large amounts of whitespace.

it's just too much.

so, with that, i'm randomizing my password to prevent my popping in out of habit. Coming here has become un-fun.

peace, I'm out.

iamthwee commented: Yule bee back +0
Tekmaven commented: You could just use the password reset if you wanted to login... +0
Nick Evan commented: And I always thought you would get banned :) +0
Salem commented: I am in complete agreement. +0
jephthah 1,888 Posting Maven

and another thing. that the quotes are dimmed and in tiny font only serves to make them just that much more unreadable.

I mean seriously, you've reduced the quotes to the level of importance as signature links and "last edited by..." notations. is this intentional?

You know, i don't consider myself old. I dont have vision problems. but when i look at this site now, generally speaking, i find it very difficult to read.

jephthah 1,888 Posting Maven

I think this thread is uncalled for

says you. I think it's very important, and shapes the direction that this site may take. apparently a number of others agree enough to comment on it, or at least vote on it.

Providing solutions rather than complaints would go a long way

I've given a solution: Remove this "feature".

and my 'complaints' are valid nonetheless. Because if a user feels the need to quote someone's previous post, whether it's selected context from the post just prior, or an entire paragraph from 10 pages back, then by all means let them do so.

When we take the pains to quote someone in our response, it MAKES NO SENSE to auto-hide the entire context to which we am responding.

as others have pointed out, it adds no value and only serves to make browsing threads more difficult.

Someone (forget who) quoted something like "99% of quotes are the full quotes of the post directly above".

that was CSCgal. and i think she said "99.9999%". I surely don't know where she gets this.

That's not even close to true in my experience... This is something that only newbies do.

Completely agree. I rarely ever see anyone post a reply with a fully-quoted repetition of the previous post. the few times i do, it's some noob who invariably gets fussed at and they don't do it again.

Like you and others have noted: when some topic, programming or otherwise, is important to …

jephthah 1,888 Posting Maven

Turbo C is certainly not a toy

well, i'll agree that it didn't use to be, but that was 20 years ago. but okay, perhaps "toy" is imprecise. Let me rephrase:

"Turbo C is a curiosity."

Museum quality.

jephthah 1,888 Posting Maven

Turbo C is a toy. an outdated, deprecated toy. No credible software developer or company uses it. Toss that junk out into the garbage pile where it belongs. Get a modern development environment with a real compiler.

Code::Blocks, for example, is a very popular free IDE. It can use any compiler including MSVC. One very nice option comes with the MinGW compiler, which is standard C used extensively in the industry.

Go get it now.

jephthah 1,888 Posting Maven

Urghhh. Will be back next week to have a look. Perhaps then all the yukkies will be sorted. This is just frustrating the hell out of me. ... getting to be too much hassle.

sadly, i agree. the usability layout color font size etc... all of it really combine to grate on my nerves.

it's like an unpleasant experience every time i log in.

jephthah 1,888 Posting Maven

i think putting a big struct of strings like "CD" and "CM" and values such as 400 and 900 (and so forth) is sloppy way to go about it and overly complicates the thing.

the algorithm behind roman numerals is simple: if the smaller value precedes the larger, then the smaller value is deducted from the larger, rather than added. (Note also that only the even powers of 10 (ie, 1, 10, 100) are ever deducted from a larger value.)

So consider this far more simplified code:

const char RoNum[7] = "MDCLXVI";
const int  RoVal[7] = {1000,500,100,50,10,5,1};

int main(void)
{
    int i; 
    int num = 2037;          // also try num = 1998
    char[32] roman = {'\0'};

    for (i=0; i<7; i++)
    {
        while (num >= RoVal[i])
        {
            num -= RoVal[i];
            strncat(roman,&RoNum[i],1);
        }
        //
        // ... more code here ...
        //
    }
    printf("Number: %d = Roman Number: %s\n\n", num, roman);
    
    return 0;
}

This will work correctly for numbers that don't require smaller values preceding larger, such as num = 2037. But it won't work correctly for numbers such as 1998. And so this only solves part of the problem.

Now the question becomes: how do you determine when a smaller value needs to be deducted from the larger, and so requiring a smaller character to precede the larger?

the solution, to be entered in the code where notated, is not much more complicated than what's already given.


.

jephthah 1,888 Posting Maven

your make_pointer function is flawed. which is what i believe Aia is saying, although her example "no-no" should have

line 6: free(ptr_a); to keep the analogy correct


look at "make_pointer" function ... why are you assigning the return pointer to 'i'? what does that mean? what do you hope to accomplish? what does 'i' represent anyhow?

tux4life commented: Good :) +8
jephthah 1,888 Posting Maven

but that doesn't change the fact that it's still hidden and a nuisance to have to see what's being discussed.

whether you have to rollover or click, it interrupts the flow of the discussion, and diminishes the point of both the OP and the responder.

I mean, go look at the discussion going on in this forum about the changes. probably every third post is quoting a previous poster on one point or another. at some points, an entire page may be one long string of responses to previous responses.

I cant just roll down and read what is being discussed at all. I can't browse and look for comments of interest. I have to physically mouse over (roll or click, whatever) each and every quoted text just so i can cipher out what the context of the response is about?

it's a mess.

So are you trying to stifle the flow of discussion? because breaking it up with having to mouse-click every third post is a sure way to put the damper on it.

I see that this is one of your cherished ideas, one of the nifty little programmatic bells and whistles that are so fun to implement. But can you show me a discussion forum of any consequence that, by default, forces inline quotes to be hidden?

how does this even make sense?

.

jephthah 1,888 Posting Maven

..

>> I don't like the way the quotes are rendered, you shouldn't have to mouse over them to see it.


i also dislike the rollover quote box that hides the quote. if i'm making the effort to quote someone, then their quote is an integral part of my response, not some tangential fluff, and it needs to be considered inline.

and what about the times where you often have to quote multiple people and address multiple points? this will quickly get ridiculous. for instance, see this recent example.

as for the argument that everyone merely re-posts long quotes of unnecessary stuff from the previous post, I disagree and in my experience here I don't believe this is even true. occasionally this happens with noobs, but by and large the most people use quotes thoughtfully and carefully to address specific points raised by a previous poster, often from several posts (or even pages) back.


until this is corrected, i suggest we quote people in the manner demonstrated with iamthwee, above. just put some spaces or dots between the quote tags, and italicize the quote in question. I think it works out pretty nice.

farooqaaa commented: Agree +0
jephthah 1,888 Posting Maven

...

>> The problem is that Obama can't think for himself. Most people use the TP as an aid in case they loose their line, Obama is clueless without it.

Good god man, pull yourself together. you're increasingly sounding like some old man who just shit his pants.

and by the way, you should learn to spell before you accuse a Harvard-trained lawyer and former Univ. of Chicago lecturer in U.S. Constitutional Law of being unable to think for himself.


For example:

"Duckman, let your tie loose; it's cutting off circulation to your head."

"Yes, I believe Duckman is going to lose his marbles."

jephthah 1,888 Posting Maven

...

>>the president doesn't have to be smart, he just has to look good on television and be able to follow the instructions of his teleprompter.
Ergo Obama, the TOTUS (Teleprompter Of The United States).

well there's the dumbest comment i've heard in this forum in quite a while.

What's wrong with your ability to engage in critical thought processes? do you have some sort of cognitive impairment?

i don't have to be an obama fanboy to recognize that every single modern president has used a teleprompter, ever since teleprompters have been available.

some presidents, like Reagan, used the teleprompter very well. he was a gifted public speaker and a master of media. Obama is also adept, though his training is from being a lawyer and not from acting.

GWB, on the other hand, looked like a deer caught in the headlights no matter how much teleprompting you gave him. some people aren't cut out for public speaking.

what's the most ironic, is these teabagging commentators and politicians who ragged on Obama for using a teleprompter, are themselves using teleprompters.

go figure.

jephthah 1,888 Posting Maven

.

jephthah 1,888 Posting Maven

we only complain because we care :)

jephthah 1,888 Posting Maven

...

>> I rely on the big orange negative rep flags and the negative votes to alert me to people I should be wary of helping. That and the avatars zone me in pretty fast. All three seem to be missing now. You have to click on the thread now and then check out the rep to see the big Scarlett Letter. I generally find that those orange dots are well earned. Any chance of bringing them back?

I totally agree. the relative reputation ranking is a huge incentive for many people to make meaningful posts.... now it's just gone. i want to see who has one green dot (new user) or one orange dot (lousy user), it's really an important difference thats useful to know before replying. And I want to immediately see which post has been upvoted or downvoted, so i can know whether or not the post needs to be taken more or less seriously.

Similarly, if someone has multiple dots (high rep), then i know to (1) pay attention to their posts more carefully and (2) not be in a hurry to post after them, as they probably have the issue covered well enough on their own, and (3) if i do have a disagreement with them, then to try and frame my disagreement in a more polite tone than I might with some random one-off poster or other internet retard.

also, i too dislike the rollover quote box that hides the …

jephthah 1,888 Posting Maven

at first i was all like "who is techtalkgal"

but then i was all like "woah"

now I'm all like "meh"

jephthah 1,888 Posting Maven

in Seattle, we have a new downtown library. A Rem Koolhaus design, it's very nice. but the bathrooms are painted entirely in this horrible lime-green color that makes you want to get out of there as soon as possible.

they did that on purpose, you see. the research shows that the grating color deters people from loitering in the bathrooms, and thus keeps the homeless and the junkies from setting up shop.

this is how i feel when i log in to Daniweb now: i go to the front page of my favorite forum, and i want to flee. once i'm in a thread, the visceral reaction is dampened, but it's still such an unwelcoming format with all the whitespace and nearly-legible font face, i don't like to linger.

did you guys do any sort of usability study? did you beta-test it? did you apply any of the numerous lessons from the vast literature of Human Factors in the design?

My impression is that you didn't.

Tekmaven commented: I am not a "Brownie Hound" so please stop giving me negative reputation. +0
jephthah 1,888 Posting Maven

i can't hardly make sense of this site anymore. it's just so damn hard to read now.

I'm sorry to be blunt, but the monochromatic color scheme, the hard contrast, the incredible overuse of whitespace.... it's horrible.

Computer Science != Design. Being able to code some Java or CSS pages does not equal an ability to effectively layout a user interface. Microsoft understands this, and that's why they employ people who are specially trained in user interface design to create their interfaces.

diafol commented: Christ I'm depressed +0
jephthah 1,888 Posting Maven

they see me rollin

they hatin

jephthah 1,888 Posting Maven

yuck.

seriously. it could have been made more difficult to read, but you'd really have had to work at it.

jephthah 1,888 Posting Maven

probably line 66: fileNames[fileCount++] = dirEntry->d_name ; you can't just assign strings like that. use strcpy() or something similar.

could be other problems, that just jumped out at me.

jephthah 1,888 Posting Maven

family guy and grey's anatomy

hey if you're from pakistan, why should i trust you to tell me a damn thing about chicago?

jephthah 1,888 Posting Maven

i can has job plz?

jephthah 1,888 Posting Maven

DUDE, pay attention.

the person you are "talking" to, last posted 5-1/2 years ago.

they are not waiting for your nuggets of wisdom.

jephthah 1,888 Posting Maven

Guyz :( you should understand that i am a human and i can be mistakened OK!

So, please don't post bad reputation points.

You all should understand that atleast I tried to write a tutorial.

Man are you all guyz perfect .. HUH! :(

when you post something and declare it is a "tutorial" then, yes, you are holding your code up to be critiqued to standards of perfection.

notice how many tutorials there currently are for C. There is one (1). that's it. now maybe there should be more, and certainly there could be more, but before you are going to add one then you better make sure your code and explanations are rock-solid and dead-on before you hit that "submit" button.

especially with something as critical as malloc(). improper/sloppy use of malloc() is the source of very many problems in programs because people don't fully understand how to use it correctly. it doesnt help matters when people who don't fully understand how to use it correctly, go and declare their half-formed ideas as "tutorials" on a search-optimized programming forum that will propagate misinformation for years to come.

had you just posted this as a question or an example -- i.e., if you had left "tutorial" out of the subject -- you wouldn't have been downvoted.

when you're really an authority on a subject, you will cite credible references, not "just your brain". at that point, you might be ready to write a tutorial.

jephthah 1,888 Posting Maven

eh, it's okay. but certainly not "the best". unless "the best" means code that has typos and memory leaks.

but the larger question is this: do you really think the OP has been waiting 5 months for you to post your favorite link?

jephthah 1,888 Posting Maven

[pseudocode]

get 'number'

do outer loop while 'number' > 9

   set value of 'sum' to zero

   do inner loop for each 10's place digit in 'number'

      increment 'sum' by value of each digit in 'number' 

   replace 'number' with this 'sum'

'number' is now sum of digits reduced to a single digit

[/pseudocode]

jonsca commented: Thanks for using pseudocode tags +4
jephthah 1,888 Posting Maven

go get another job, right now.

then (and only then) tell the president of the first one to stick his lawn mowing job right up his ass.

jephthah 1,888 Posting Maven

The point system is stated in the Rules. Suggest you read them.

bah. reading rules is for wimps.

jephthah 1,888 Posting Maven

Well, what does "%n" do in scanf()? I couldn't find any reference to it here. And it seems to not do anything in the code that's been posted in this thread either. But if I enter
HelloWorld 1 2
Then the string length is correct, for some odd reason.

Perhaps you should read the thread before replying? Tux4Life gave a beautifully detailed explanation just a few posts earlier, that even the most inexperienced newbie can understand.

and seriously, cplusplus.com is a nice reference to point new programmers to, just as a simplistic reference to get them started, but it clearly is not a definitive or complete specification. you should know this.

If only by virtue of your longevity, reputation, post and post-solved counts, newer programmers assume you are one of the top C/C++ "experts" on this site, and often take your words as literal truth. Whether you like it or not. So you should at least refrain from asking incredulous, noobtastic questions before doing some your own nominal investigation using credible sources. And quit with the silly sniping at Aia. Her tone may annoy you, but you should be more careful about posting C++ in a C forum, considering it's a major issue here.