In this blog post I am going to describe you how to use Pastebin.com to share your code. At the moment FutureLearn is in Beta release and it does not provide the facility to share code snippets (also called sections of source code, parts of programmes etc) by pasting it to comments. But when we move on to Week2 onward on the MOOC we will be doing bit of coding, which unfortunately can go wrong and leave us with errors to correct. If the code that gives the error can be shared with us we would be able to resolve the issues more easily so in this blog I will describe using Pastebin as a workaround for the time being.
Go to www.pastebin.com
Now copy the code segment that gives you errors in your programme. Highlight the statement(s) and copy them to clipboard (you can press CTRL and C keys to copy). Now paste this code in the box highlighted in the below diagram. (You can press CTRL and V keys to paste).
I am going to paste some code and show it in the next illustration.
Unlike the code we see in Eclipse IDE this code block does not have syntax highlighted. But it is much easier to read code when the syntax is highlighted. So let's make the syntax highlighting now.
Click the down arrow in Syntax Highlighting. A drop down menu will appear. From this select 'Java'.
Leave other options as they are and click 'Submit'
Submitting the code will take you to a screen similar to this. Notice that the code you have pasted has its syntax highlighted. Now copy the URL by highlighting and pressing CTRL and C
In your comment on FutureLearn paste the URL copied from Pastebin
Now by clicking the given Pastebin URL participants and helpers can access the code.
Hope this guide helps you in using the tool Pastebin to share your code with others.