About CodeProject....
-
Hi CPians, Well, I have been using some code from several articles, and I am thinking about giving something back. You all know how difficult it may be to write an article which illustrates something interesting, well written, etc, etc... It takes time. While trying to illustrate some key points, I started thinking that I have some code snippets, tips, etc, that are not big enough (complete enough) to be an article. I am not sure if this has been discussed before (or it may even already exist) but I think it would be nice to have a Codeproject section with this kind of stuff : code snippets, etc, that do not have the category of an article. I think that there are some CPians that would contribute some of their "coding habilities" but do not have the time to write a full article. Imagine a new section (rating would be quite inappropriate here) with this kind of stuff. Contributions could be in form of single simple classes (eg: a sample of ATL::CWorkerThread) functions (using ATL::ATlPath), and related things. The bad thing is that it would require that these code snippets were well organized into sections, and it may be plain too much work to set it up. You may also say that even if they are *short*, they can be articles. What do you think? Regards, R.
-
Hi CPians, Well, I have been using some code from several articles, and I am thinking about giving something back. You all know how difficult it may be to write an article which illustrates something interesting, well written, etc, etc... It takes time. While trying to illustrate some key points, I started thinking that I have some code snippets, tips, etc, that are not big enough (complete enough) to be an article. I am not sure if this has been discussed before (or it may even already exist) but I think it would be nice to have a Codeproject section with this kind of stuff : code snippets, etc, that do not have the category of an article. I think that there are some CPians that would contribute some of their "coding habilities" but do not have the time to write a full article. Imagine a new section (rating would be quite inappropriate here) with this kind of stuff. Contributions could be in form of single simple classes (eg: a sample of ATL::CWorkerThread) functions (using ATL::ATlPath), and related things. The bad thing is that it would require that these code snippets were well organized into sections, and it may be plain too much work to set it up. You may also say that even if they are *short*, they can be articles. What do you think? Regards, R.
As Chris has said in the past, snippets would be a much contributed thing, and it would be impossible to organise them in a way that people would actually be able to browse and use them. Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?! - Jon Hulatt, 22/3/2002
-
Hi CPians, Well, I have been using some code from several articles, and I am thinking about giving something back. You all know how difficult it may be to write an article which illustrates something interesting, well written, etc, etc... It takes time. While trying to illustrate some key points, I started thinking that I have some code snippets, tips, etc, that are not big enough (complete enough) to be an article. I am not sure if this has been discussed before (or it may even already exist) but I think it would be nice to have a Codeproject section with this kind of stuff : code snippets, etc, that do not have the category of an article. I think that there are some CPians that would contribute some of their "coding habilities" but do not have the time to write a full article. Imagine a new section (rating would be quite inappropriate here) with this kind of stuff. Contributions could be in form of single simple classes (eg: a sample of ATL::CWorkerThread) functions (using ATL::ATlPath), and related things. The bad thing is that it would require that these code snippets were well organized into sections, and it may be plain too much work to set it up. You may also say that even if they are *short*, they can be articles. What do you think? Regards, R.
My wildcmp article is pretty much a snippet but I submitted it anyways since I thought some people might get some use out of it. I think I would prefer a snippet to an article for short easy things that don't require alot of explaination. I also personally don't see a problem with having the snippets included with the articles here. Most of the code sites out there seem to be a collection of snippets and have a special place for articles rather than vise versa. -Jack To an optimist the glass is half full. To a pessimist the glass is half empty. To a programmer the glass is twice as big as it needs to be.
-
Hi CPians, Well, I have been using some code from several articles, and I am thinking about giving something back. You all know how difficult it may be to write an article which illustrates something interesting, well written, etc, etc... It takes time. While trying to illustrate some key points, I started thinking that I have some code snippets, tips, etc, that are not big enough (complete enough) to be an article. I am not sure if this has been discussed before (or it may even already exist) but I think it would be nice to have a Codeproject section with this kind of stuff : code snippets, etc, that do not have the category of an article. I think that there are some CPians that would contribute some of their "coding habilities" but do not have the time to write a full article. Imagine a new section (rating would be quite inappropriate here) with this kind of stuff. Contributions could be in form of single simple classes (eg: a sample of ATL::CWorkerThread) functions (using ATL::ATlPath), and related things. The bad thing is that it would require that these code snippets were well organized into sections, and it may be plain too much work to set it up. You may also say that even if they are *short*, they can be articles. What do you think? Regards, R.
Ramon Casellas wrote: What do you think? Jason Jystad and myself are putting together a generic Code Snippet Library article and code base. If Chris thinks it is good enough then we may see some kind of CP snippet library in the future :) I agree though, this kind of feature is very useful, especially for new developers. regards, Paul Watson Bluegrass Cape Town, South Africa The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
-
Hi CPians, Well, I have been using some code from several articles, and I am thinking about giving something back. You all know how difficult it may be to write an article which illustrates something interesting, well written, etc, etc... It takes time. While trying to illustrate some key points, I started thinking that I have some code snippets, tips, etc, that are not big enough (complete enough) to be an article. I am not sure if this has been discussed before (or it may even already exist) but I think it would be nice to have a Codeproject section with this kind of stuff : code snippets, etc, that do not have the category of an article. I think that there are some CPians that would contribute some of their "coding habilities" but do not have the time to write a full article. Imagine a new section (rating would be quite inappropriate here) with this kind of stuff. Contributions could be in form of single simple classes (eg: a sample of ATL::CWorkerThread) functions (using ATL::ATlPath), and related things. The bad thing is that it would require that these code snippets were well organized into sections, and it may be plain too much work to set it up. You may also say that even if they are *short*, they can be articles. What do you think? Regards, R.
This has been suggested before. The last person I think was Paul Watson. I thought he'd gone off to develop a way of doing this. Do you remember this Paul? ;P Michael :-)
-
Ramon Casellas wrote: What do you think? Jason Jystad and myself are putting together a generic Code Snippet Library article and code base. If Chris thinks it is good enough then we may see some kind of CP snippet library in the future :) I agree though, this kind of feature is very useful, especially for new developers. regards, Paul Watson Bluegrass Cape Town, South Africa The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
Ah, I see you do remember. Ignore my flippant remarks in my previous message :-O Michael :-)
-
My wildcmp article is pretty much a snippet but I submitted it anyways since I thought some people might get some use out of it. I think I would prefer a snippet to an article for short easy things that don't require alot of explaination. I also personally don't see a problem with having the snippets included with the articles here. Most of the code sites out there seem to be a collection of snippets and have a special place for articles rather than vise versa. -Jack To an optimist the glass is half full. To a pessimist the glass is half empty. To a programmer the glass is twice as big as it needs to be.
Jack, only a warning on your function, for better utilization of stack frame space, you should only declare yout variables when they will effectively be used. I'm talking about -> char *cp, *mp; Why waste 8 bytes of stack space when you only need them after the first while loop ? As a rule of thumb you should only declare variables where they are really to be used.In many cases is when you first initialize your variables. ps. : I really liked your function, and I didn't understood the response of the "c++ guru" that implemented your code using recursive functions, of course this leaded to a poorer performance of the function, something that's not intended with your function. ps 2: I don't dislike recursion, but it have specific uses. Cheers, Joao Vaz
-
Jack, only a warning on your function, for better utilization of stack frame space, you should only declare yout variables when they will effectively be used. I'm talking about -> char *cp, *mp; Why waste 8 bytes of stack space when you only need them after the first while loop ? As a rule of thumb you should only declare variables where they are really to be used.In many cases is when you first initialize your variables. ps. : I really liked your function, and I didn't understood the response of the "c++ guru" that implemented your code using recursive functions, of course this leaded to a poorer performance of the function, something that's not intended with your function. ps 2: I don't dislike recursion, but it have specific uses. Cheers, Joao Vaz
Joao, Thanks for your reply. The reason I declared those two pointers there is because some compilers give warnings/errors if the variables are not declared at the very top of a statement so with said compiler you can't just declare them at the bottom of the first loop. I'm sure there is probably a way to get around it but that is why I did it that way. I do completely agree with you about only declaring variables in the scope where they are needed. Thanks, Jack To an optimist the glass is half full. To a pessimist the glass is half empty. To a programmer the glass is twice as big as it needs to be.
-
Joao, Thanks for your reply. The reason I declared those two pointers there is because some compilers give warnings/errors if the variables are not declared at the very top of a statement so with said compiler you can't just declare them at the bottom of the first loop. I'm sure there is probably a way to get around it but that is why I did it that way. I do completely agree with you about only declaring variables in the scope where they are needed. Thanks, Jack To an optimist the glass is half full. To a pessimist the glass is half empty. To a programmer the glass is twice as big as it needs to be.
-
Jack Handy wrote: some compilers give warnings/errors Strange, if this is the case ,do you tried to initialize them to null ? Cheers, Joao Vaz
With gcc if I declare them below the first while loop i get this error: mywild.c:21: parse error before `char' line 21 is where I am declaring them:
char \*cp, \*mp;
Then I get undeclared variable errors for cp and mp in the rest of the function: mywild.c:28: `mp' undeclared (first use in this function) mywild.c:28: (Each undeclared identifier is reported only once mywild.c:28: for each function it appears in.) mywild.c:29: `cp' undeclared (first use in this function) This is because gcc requires you to declare your variables at the top of a statement. I could enclose everything after the first while loop with if (1) { //everything } so they would be declared at the top of the if statement but depending on the compiler that would probably lead to extra instructions and it would just look messy to me. -Jack To an optimist the glass is half full. To a pessimist the glass is half empty. To a programmer the glass is twice as big as it needs to be.
-
With gcc if I declare them below the first while loop i get this error: mywild.c:21: parse error before `char' line 21 is where I am declaring them:
char \*cp, \*mp;
Then I get undeclared variable errors for cp and mp in the rest of the function: mywild.c:28: `mp' undeclared (first use in this function) mywild.c:28: (Each undeclared identifier is reported only once mywild.c:28: for each function it appears in.) mywild.c:29: `cp' undeclared (first use in this function) This is because gcc requires you to declare your variables at the top of a statement. I could enclose everything after the first while loop with if (1) { //everything } so they would be declared at the top of the if statement but depending on the compiler that would probably lead to extra instructions and it would just look messy to me. -Jack To an optimist the glass is half full. To a pessimist the glass is half empty. To a programmer the glass is twice as big as it needs to be.