OT - Tips for width constrained text

  • Thread starter Andrew Thompson
  • Start date
A

Andrew Thompson

There has been some discussion on a thread about these
parts, as to the difficulty of posting code that is constrained
by width (as the SSCCE document, ..as well as common
sense, might suggest when posting code to usenet).

One suggestion was raised to simply upload the code to
a web site and provide an URL - this is a good solution, in
that it completely removes the need to worry about line-wrap.
Lines do not wrap in code that is downloaded.

GeoCities was suggested as one free place to upload code,
but another poster pointed out that GG users also had the
option to upload 'documents' to their GMail accounts and
link directly to that.

The one reservation I have with linked code though, is that
some people who either "read off-line", or "just don't click
links - ever"*, do not have access to it, and the responses
might be fewer and further between. Also, asking people
to post to the group really puts the pressure on to keep
the code *short*. Code at the end of links often has 40
buttons (etc.) not needed to display the problem.

* And I suspect that is a lot of people.

So.. for those wanting to post code to groups, who have
trouble figuring how wide it is, I suggest this scale.

/*
12345678901234567890123456789012345678901234567890123456789012345
1 2 3 4 5 6
*/

Paste that comment into Java source code shown in
a fixed width font, and it is easy to judge when later
code will exceed the 'limit'.

What is the limit? I have heard it suggested at 72 chars,
but to be safe, I suggest limiting code lines to no more
than 65 chars.

HTH

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200708/1
 
S

Stefan Ram

Andrew Thompson said:
the difficulty of posting code that is constrained by width

I do not get your point.

I write this here text.
Its width is restricted
to 40 characters at most.
I can also post it.

What is difficult about it?
What is the question or
problem you write about?

(Actually text is not
constrained by a width,
it /has/ a width. A text
generating /process/ might
be constrained by a width.)
 
L

Lew

Stefan said:
Its width is restricted

Thank you for spelling "Its" correctly. That is one of my bugbears, and it's
always a pleasure to see it used correctly.

Your point about being able to restrict your text to 40 characters is well
taken, but I sing hosannas to Andrew for providing a helpful scale for those
who might benefit. He's provided a tool to help a Usenet poster visually
confirm that they're staying within the margin.

Hosanna, heysanna!
 
J

Joe Attardi

Andrew said:
So.. for those wanting to post code to groups, who have
trouble figuring how wide it is, I suggest this scale.

/*
12345678901234567890123456789012345678901234567890123456789012345
1 2 3 4 5 6
*/

This is a good idea, definitely.

As for websites, a lot of IRC channels I frequent use "pastebins". For
an example of a well known pastebin in the ##java channel on
irc.freenode.org, you can check out http://eugeneciurana.com/pastebin/.

If there was enough interest in using this approach somebody could
always set up a semi-"official" comp.lang.java.programmer pastebin.

Just adding my thoughts..
 
J

Joe Attardi

Andrew said:
For a short, heady time, I actually had an on-line
compiler available to attach to on-line codes, and
compile them directly from a web page (with no
JRE/JDK on local PC).

How did that work, did you just give it the URL of some Java source code
stored online and it would fetch the text and compile it as if it were a
..java file?
 
A

Andrew Thompson

Joe said:
How did that work, did you just give it the URL of some Java source code
stored online and it would fetch the text and compile it as if it were a
.java file?

Paste it* into an HTML form, select some (javac) options,
as well as versioning options (it could compile against
1.1 -> 1.4 rt.jars) click the 'Submit/Compile' button.

* The code needed to be an SSCCE** - no references
to other non J2SE classes.

The results page showed the formatted Java source
and either compilation errors, or an applet with a
button to launch it (sandboxed) or a link to the .jar
(for download, or standard app. run).

If I were to do it again, I might do it as a JWS app.,
with the various rt.jar's supplied lazily, but.. I am not
sure of my right to actually distribute the rt.jar's, and
the latest runtimes have become a significant wallop
to download, in any case.

Of course, the JWS option would require the end-user
to have a JRE installed, which the 'on-line' compiler did
not. ( But then, I always did wonder what the point of
developing Java, using a box that does not run it, could
be ;).

** I did consider something more like what what you
indicated, to get around the 'single source file' limitation.
Offer the user to upload a Zip/Jar archive containing
source, and do the compilation on all the source in the
archive. But with my paranoia about getting 100's of
kilobytes (or megabytes) of code dumped to the server,
I never bothered proceeding with it.

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200708/1
 
S

Stefan Ram

Andrew Thompson said:
That comment resulted as my way of bowing out of this thread..

Roedy Green is a very experienced programmer and Usenet
author, a regular poster in this group. I see, that even he,
in his recent »refactoring« posting, was not able to avoid
ugly line breaks while he was not posting via Google.

So how can one expect to educate Google posters, who might
only post to this group once for a single question, about this?
 
L

Lew

Stefan said:
Roedy Green is a very experienced programmer and Usenet
author, a regular poster in this group. I see, that even he,
in his recent »refactoring« posting, was not able to avoid
ugly line breaks while he was not posting via Google.

I hear agreement on the principle that it's good to help people post
effectively, disagreement on whether advice about line formatting achieves
that goal.

I propose that we acknowledge arbitrary line breaks as an obfuscatory issue,
and occasionally perhaps mention it helpfully to folks that seem to be
struggling with it more than others. Andrew's offer of a column-count
template is a helpful one; I've used the same technique any number of times to
lay out screen text.

Everyone is a champion of the benighted Google Groups users, and no one blames
the victims. Gentleness with the these hapless folks upon whom are such
foibles foisted is the only correct attitude.
So how can one expect to educate Google posters, who might
only post to this group once for a single question, about this?

These newsgroups educate best the regulars; what benefit accrues to those who
never return is a general question.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top