trailing spaces in code snips - pls neutralize with prejudic

Hey, Justin, since you're basking in the spotlight (ha ha!) While you're at it, could you-all clip all trailing spaces from posts? There is absolutely no reason to retain them, that I can think of, but many people "cut/paste" from posts and pick up garbage spaces (mostly applicable to batch, but...). I try to "rtrim" my posts, but maybe I forget. I posted this instead of PM so other people could comment yea or nay. Just now had to deal with this, but it's happened in the past also.

This isn't that difficult to do, but it may have some unintended consequences (for example, making it impossible to put any trailing spaces in postings). Is this something you see a lot? Can you give me a few examples of it messing up postings that you've seen recently?

Yeah an example would be nice. It seems kind of 'nit-picky' to be bothered by a few extra spaces in a posting unless it's really blatant.

The only thing I've noticed is some posters seem to be using a text editor without word wrap causing their responses to not make an exact fit when pasted to the computing.net reply box. But it's never bothered me.

@dave: note I said "RTRIM", not "ALLTRIM". I just wish the ends of the lines would be the ends of the lines, and not just appear to be.Here's the post in question:http://www.computing.net/answers/pr...(I pmailed the OP with the reason the compares were failing. He, or I, had unintentionally left spaces trailing the ends of the lines.)Anyway, not a big issue, just a suggestion. It really only applys to batch, that I know of.ps:"(for example, making it impossible to put any trailing spaces in postings)." Isn't that what

this

is for?And, to counter your challenge, please explain what possible value trailing spaces on any line of code (or text) can have? Unless it's some obscure word-wrap issue that I'm clueless about. I'm not trying to be "nit-picky", just making a suggestion to help keep these kinds of problems from recurring.pps: just remembered, we worked on this problem via pmail, so here's the exchange:(PM from OP):Here is the the exact code that I'm using to test the batch script that you have been helping with.

Make SURE there are no spaces at the ends of those two lines. This was neither of our faults, blame it on the forum, i guess. I'm going to make a suggestion to Justin to see if they can "right-trim" all posts. There is no possible way that a post needs trailing spaces. This has happened before. Let me know if this helps.

end of exchangehe was trying to compare two numeric values, but one value had the trailing spaces, and the other did not, so the IF compare was failing every time. Alright, I'm done.

I see what you mean. I was thinking about pure text responses and not programming lines.

Maybe it would be helpful to have an 'end of line' character for text responses that the user would understand needed to be removed if he pasted the solution into his own work. That way if he also copied and pasted trailing spaces the EOL character would show where the line was supposed to end and the user could delete anything after that.

A Start of Line character might be helpful too if there was any additional confusion. As long as the user understood the characters weren't part of the program, how they were used and needed to be removed before running it I think it would work.

Yeh, that would work, if posters were aware of it. That's my concern, that most posters (especially in batch) are just not ready for that degree of discretion. Anyway, I'm not "ranting", just giving food for thought. Some kind of EOL marker would be good if it were understood, it's the understanding/interp that might foul that gear. Justin said that an "RTRIM" op would not be too difficult. Anyway, just thought I'd give some "front-line" reports.

If something like that was done the specifics would have to be stated on the Programming forum page, maybe more than once. But I suppose some people would still miss that and then wonder why the program isn't working for them. Well, that's something contributors to that forum can work out.

I misunderstood you, I thought you meant trim all what spaces at the very end of every posting, not at the end of each line.

What you are suggesting could still be done. However, it would be more difficult. Also, I can envision even more unintended consequences... anytime you start playing around with postings that users make, strange things can happen.

I think it would be better to try to understand how those spaces get there and maybe address that. If the user is inserting a trailing space himself into the textbox, then it needs to be reflected, as that is his problem. I could envision someone saying, "Why does this code not work" when us removing trailing spaces from the original he pastes fixes it. If, through copying and pasting it into the textbox, a trailing space is added, then we need to figure out why.

I agree Justin, if we can figure out where they're creeping in, then they can be dealt with some other way. It might have to do with the auto-word-wrap. I don't type in a space at the end of any line that I'm aware of. (I used to use "hard returns" when I first started, now I just let the junk wrap itself silly.) I'll just shut up and try to see what's going on. If I learn something, I'll of course let you know.ps: reviewed your last post, and I understand it better: by removing the offensive trailing spaces, the problem is solved, but without really getting to the root of it. What would be really sweet would be some kind of indicator, such as slight foreground/background shading adjustment that would show the trailing spaces, sort of along the lines of what Dave said, but passive and not active. But I know those kinds of fine-tuning can be more trouble than they're worth because half the time they don't work anyway. ttyl Ttyl

Trailing whitespace is trivial IMO and is trivial to fix. All it takes is a simple regex. If done correctly, that's 1 line of code.

There are bigger fish to fry. I find the lack of "code tags" which would not only retain the formatting much like the pre tags, but also encapsulate the code in its own scrolling box. This is a very common feature in all other forums that I work with. Another missing feature is the quote tags to allow us to cleanly quote portions of prior comments.

Since this thread was kicked off due to a perceived issue with posting batch code, I must ask why the authors of the posted code don't make use of the pre tags. And even when they do, why the lack of proper whitespace (indentation and line breaks)?

starting at about post # 145. I hope that was enough to disuage Justin from including that irritating, unnecessary feature. After all it's so easy to just do a copy and paste and enclose that in quotes if you want to include a comment from a previous posting--like I did with your sentence above.

I'm not suggesting nor advocating using the quote tags to quote entire posts like is typically done in email threads, which is what the logic of your rebuttal suggests. That would be absurd.

The usage of the quote tags I suggest is just as valid as using the current selection of tags. The advantage of the quote tags would be 1) it could/would clearly indicate who you're quoting, which is helpful when there are multiple users posting especially in longer threads, 2) it separates the quote from your response by a physical separation and/or uses a different font, which IMO adds clarity/readability.

Since you didn't rebut my suggestion of the code tags, I assume that you agree with me on that point.

I have no opinion on code tags. As I mentioned above, that's for the programming forum contributors to work out. The last real programming I did was FORTRAN and BASIC. Not much call for that anymore.

As far as quote tags, the problem is that having that feature encourages people to use it--almost always unnecessarily. Post after post after post contains the same:

>>hey look>>this is being echoed for the 37th time in this thread!!!>>Yipee!!!

It doesn't help to distinguish who you're quoting as the reader will still need to scroll up to refresh their memory. If separating the quote from the response is necessary well, just hit ENTER once or twice.

"As far as quote tags, the problem is that having that feature encourages people to use it--almost always unnecessarily."

If that's true, then the same absurd claim could be made of the pre tag, and the bold tag, and the italics tag, which I've never seen to be used "almost always unnecessarily". And your "post after post" example is absurd.

"It [the quote tag] doesn't help to distinguish who you're quoting as the reader"

I must assume you don't work with very many forums. Most of the ones I work with have a quote tag that can include as part of its quote header/caption the user that you're quoting. That simple capability must beyond the capabilities of this forum software and outside of your experience.

Regarding the fonts, you manually need to add those tags rather than having the quote tags set a default font that is changeable and so far I haven't found any documentation on this site indicating the available formatting options. That type of info should be easily and clearly available, which it isn't.

Having or not having the quote tag is a minor issue, but it's one example where IMO, this site falls short compared to others that I use.

Yeah I don't work with very many forums. I have, you know, a life. But I have been here awhile and while searching for solutions I've come across a lot of incessantly repetitive quoting on other sites. Sorry I can't provide examples but I never kept track of them. But I'll probably come across some before this thread is closed.

Note that you had no problem quoting me in a way that anyone reading it will understand and not find confusing, even with the stone-age techniques you were forced to use.

They're always making changes here and I suppose it'd be OK if it was easier to swap fonts and the like. It seems unnecessary but I guess there are people who are bothered by any online activity that takes more than a single mouse click. But no echoing/quote tags.

The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this
site. Computing.Net and Compnet Ventures, LLC hereby disclaim all responsibility
and liability for the content of Computing.Net and its accuracy.