How to post code in a thread?
Keith Young
Posts: 569
Sorry I've searched around and not found the answer here, though this has probably been covered. How to we post code to a thread? Hundreds of lines in this case.
I know I can attach the code files. I was hoping there's a way to post code like most code related sites allow.
I know I can attach the code files. I was hoping there's a way to post code like most code related sites allow.
Comments
Best to attach a ZIP file for now.
You have to click the <> button in the editor first before typing the HTML stuff.
-Phil
<pre style="background-color:#ffffe0;max-height:400px;max-width:fill-available;overflow:auto;font-family:Parallax,Courier,monospaced;font-size:11pt;line-height:11pt;border-style:solid;border-width:1px;padding:5px">
Paste code here.</pre>
You have to click the <> button in the editor first before typing the HTML stuff.
-Phil
Phil,
Does that have the character limitation? Have not tried it.
http://forums.parallax.com/discussion/161769/activitybot-sirc-control-whiskers
is as follows.
I type my normal text (2 paras or 1 para and my name with a couple of line feeds between them).
Then I click on the "<>" button on the right side of the icons at the top of the edit window. That shows me my text and a lot of formatting stuff.
I put the cursor between the "<br">s between the paragraphs and press "enter" a couple of times to give some space.
Then I type <pre> and </pre> at the beginning of the space where I want my code (with a couple of blank lines between them).
Then I paste the code in the space between the <pre> and </pre>.
Not as easy as , but it works.
There is at least one other method, but I'm not sure how to do it. EDIT: The other method is in the third post of this thread, and adds formatting.
Tom
Yes, unfortunately. When I pointed out in another thread that the limitation should not apply to code -- especially in a scrolled code box that takes up limited space -- the response was just to attach the file rather than to display it.
-Phil
horizontal and vertical scrolling! Oh well, I guess it is time to learn HTML.
That's a random thing in my GitHub account. I'm thinking about just using that and ignoring code features here.
Opens in a new window, has the syntax highlight, though I'm not sure that is true for SPIN. (probably not)
BTW, here is Vanilla, if you want to go looking at it.
https://github.com/vanilla/vanilla
The way I see it, attaching here makes no sense. If we can display it in a window, great! That's handy, and like people say, right here for discussion. But, if it won't fit, or it's a PITA, then using GitHub brings revisions, collaboration, and other features. Much higher value IMHO.
Yes, unfortunately. When I pointed out in another thread that the limitation should not apply to code -- especially in a scrolled code box that takes up limited space -- the response was just to attach the file rather than to display it.
-Phil
15K is the max character limit in a post.. So the way to post code is a ZIP file.
Hopefully the ZIP file download name not being the same will be resolved soon.
-Phil
-Tor
Where did your hear such a thing?
Now, putting it into OBEX is another matter. If I remember Parallax has attached the MIT licensing condition to that. That does rather imply that you must have the right to apply that license to the code. Posting GPLed code to OBEX would be a no-no.
Posting a link to a repo like github certainly has no impact on whatever licence that code is subject to.
http://stage-forums.parallax.com/
and they work OK.
I agree that posting a link to elsewhere cannot imply (re-)licensing the code. So it was kind of a rhetorical question. Using it as a method of getting code properly formatted (as long as the forum can't do it properly by itself) is not the same then - you can't just use the code as you wish, unlike posted code (if my memory is correct about that, and I'm quite certain).
Edit: From the forum guidelines thread (sticky, in announcements):
-Tor
No doubt lawyers could debate this all day but as far as I'm concerned copyright law has the provision for "fair use". I take that as meaning that posting a quote from a copyrighted work is OK. That certainly works for books and such like. I see no reason why it should not work for source code snippets. As long as they are not the entire or substantial part of the work.
Certainly nobody is going to bother tracking down the licence attached to every little snippet they post here.
If Parallax want to put an MIT license on something I have written myself and posted here I'm fine with that.
Many of us were concerned, and couldn't look at the code for fear of some license snafu, thus the snippet language was born.
Fair use is actually a legal defense that is composed of a legal test and actually doesn't exist as a defined state in US Copyright Law. When one cites fair use, really that is something like "justified or acceptable infringement" leaving the status of whatever is infringed, and the infringing work unchanged.
Translation: "Fair use = I believe this minor infringement is OK." That's it.
That legal test generally is:
http://fairuse.stanford.edu/overview/fair-use/four-factors/
The four factors judges consider are:
- the purpose and character of your use
- the nature of the copyrighted work
- the amount and substantiality of the portion taken, and
- the effect of the use upon the potential market.
- See more at: http://fairuse.stanford.edu/overview/fair-use/four-factors/#sthash.rPfBEt6r.dpufThe four factors judges consider are:the purpose and character of your use
the nature of the copyrighted work
the amount and substantiality of the portion taken, and
the effect of the use upon the potential market.
And the only way to get a definitive answer is to present the fair use work in court. Ugh... Otherwise, one can look at all the successful case law on fair use and compare, or more generally, look at and compare to other infringing activities that appear as fair use, which Heater did above. If it seems to make sense and is generally OK, it probably is.
That's how we know satire, for example, is protected and fair use. For snippets, the fact that it happens all the time, and people cannot have academic discussions without it happening and that it doesn't really impact anyone economically is a very strong fair use defense. I'm not sure there is a lot of case law on code snippets, but there is a lot of it related to academic type discussion of copyrighted works. It's best we don't ask that legal question. We are likely to lose out more than we are to see an expansion or more formal treatment of it all. This is due to the fact that the major rights holders will always, always seek to marginalize fair use. Just saying...
"Treated as MIT, minus the license attribution requirement", avoids the tangle of public domain, which also barely exists in US Copyright Law where every creative work automatically has copyright and it's questionable as to how exactly one does put something into the public domain. I don't actually know how to put something into the public domain. I do know it will end up there after an embarrassingly long time though. Interesting isn't it?
So basically, the "treating it as MIT, minus the requirements..." means "do what you want with it" with no real worries and no requirement to post a license and all that jazz just to discuss some code.
It's not a matter of Parallax wanting anything other than the discussion that is supposed to happen here really. It is a matter of finding some easy path to overall compliance that doesn't bother anyone. And it's not actually transformative in terms of the license either. "treated as" is just a concise expression to communicate the intent of the rules on forum snippets, not a declaration nor assignment of license. Just FYI. A declaration or assignment would actually require some agreement be made, or notice given, and who wants to bother with all of that mess?
So we don't bother. And nobody cares, until they do. Hopefully, nobody cares, and if they do, the intent here is expressed clearly, and hopefully that all is good enough. And that all is about as good as it gets without things getting really painful.
I had a small part in helping resolve that matter and the language, which is why I'm speaking to it now. Really, the intent is "no worries" on code posted to the forum as a snippet. As it should be. And I've sadly had some experience dealing with licensing. And it's generally painful outside the small realm we inhabit here too. Did I mention mind numbingly painful? Yeah.
This all mostly goes unsaid, but in this case, somebody actually wanted it said, so it's said in very reasonable fashion. That's it as far as intent goes too.
Finally, this is the kind of thing that happens when someone somewhere wants it said. Be careful what you wish for. You might just get it! Great lesson there from that school of hard knocks.
The four factors judges consider are:
- the purpose and character of your use
- the nature of the copyrighted work
- the amount and substantiality of the portion taken, and
- the effect of the use upon the potential market.
- See more at: http://fairuse.stanford.edu/overview/fair-use/four-factors/#sthash.rPfBEt6r.dpufThe four factors judges consider are:- the purpose and character of your use
- the nature of the copyrighted work
- the amount and substantiality of the portion taken, and
- the effect of the use upon the potential market.
- See more at: http://fairuse.stanford.edu/overview/fair-use/four-factors/#sthash.rPfBEt6r.dpuf