www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Many documentation examples can now be run online

reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Take a look e.g. at 
https://dlang.org/phobos-prerelease/std_algorithm_iteration.html. 
Examples now have "Edit" and "Run" buttons that allow you to play with 
them online and see what they output. Changes for the ddox version 
forthcoming.

Related: https://github.com/dlang/dlang.org/pull/1297, 
https://issues.dlang.org/show_bug.cgi?id=16984, 
https://issues.dlang.org/show_bug.cgi?id=16985.

Many thanks to Sebastian Wilzbach who took this to completion, and to 
Damian Ziemba for working on the online compiler code!


Andrei
Dec 19 2016
next sibling parent reply Seb <seb wilzba.ch> writes:
On Monday, 19 December 2016 at 17:44:29 UTC, Andrei Alexandrescu 
wrote:
 Take a look e.g. at 
 https://dlang.org/phobos-prerelease/std_algorithm_iteration.html. Examples now
have "Edit" and "Run" buttons that allow you to play with them online and see
what they output. Changes for the ddox version forthcoming.

 Related: https://github.com/dlang/dlang.org/pull/1297, 
 https://issues.dlang.org/show_bug.cgi?id=16984, 
 https://issues.dlang.org/show_bug.cgi?id=16985.

 Many thanks to Sebastian Wilzbach who took this to completion, 
 and to Damian Ziemba for working on the online compiler code!


 Andrei
I would like to add that this is in an experimental/testing stage and hopefully will get stable with the next release ;-)
Dec 19 2016
next sibling parent reply Joakim <dlang joakim.fea.st> writes:
On Monday, 19 December 2016 at 17:50:17 UTC, Seb wrote:
 On Monday, 19 December 2016 at 17:44:29 UTC, Andrei 
 Alexandrescu wrote:
 Take a look e.g. at 
 https://dlang.org/phobos-prerelease/std_algorithm_iteration.html. Examples now
have "Edit" and "Run" buttons that allow you to play with them online and see
what they output. Changes for the ddox version forthcoming.

 Related: https://github.com/dlang/dlang.org/pull/1297, 
 https://issues.dlang.org/show_bug.cgi?id=16984, 
 https://issues.dlang.org/show_bug.cgi?id=16985.

 Many thanks to Sebastian Wilzbach who took this to completion, 
 and to Damian Ziemba for working on the online compiler code!


 Andrei
I would like to add that this is in an experimental/testing stage and hopefully will get stable with the next release ;-)
When all tests pass, would be better if it said that, rather than "No output," which it says now.
Dec 19 2016
next sibling parent reply Timothee Cour via Digitalmars-d-announce writes:
is it properly sandboxed / hacking proof?

quick tests:

```
import std.process;
auto msg="sleep 10";
executeShell(msg).output.writeln;
```

 correctly results in `Application output (9: Killed)`

"ls -al .."  => permission denied

"ls /usr/bin/ld" => -rwxr-xr-x 2 0 0 834648 Jan  3  2013 /usr/bin/ld

"ps -auwx" => ...



On Mon, Dec 19, 2016 at 6:25 PM, Joakim via Digitalmars-d-announce <
digitalmars-d-announce puremagic.com> wrote:

 On Monday, 19 December 2016 at 17:50:17 UTC, Seb wrote:

 On Monday, 19 December 2016 at 17:44:29 UTC, Andrei Alexandrescu wrote:

 Take a look e.g. at https://dlang.org/phobos-prere
 lease/std_algorithm_iteration.html. Examples now have "Edit" and "Run"
 buttons that allow you to play with them online and see what they output.
 Changes for the ddox version forthcoming.

 Related: https://github.com/dlang/dlang.org/pull/1297,
 https://issues.dlang.org/show_bug.cgi?id=16984,
 https://issues.dlang.org/show_bug.cgi?id=16985.

 Many thanks to Sebastian Wilzbach who took this to completion, and to
 Damian Ziemba for working on the online compiler code!


 Andrei
I would like to add that this is in an experimental/testing stage and hopefully will get stable with the next release ;-)
When all tests pass, would be better if it said that, rather than "No output," which it says now.
Dec 19 2016
parent Seb <seb wilzba.ch> writes:
On Tuesday, 20 December 2016 at 06:16:23 UTC, Timothee Cour wrote:
 is it properly sandboxed / hacking proof?

 quick tests:

 ```
 import std.process;
 auto msg="sleep 10";
 executeShell(msg).output.writeln;
 ```

  correctly results in `Application output (9: Killed)`

 "ls -al .."  => permission denied

 "ls /usr/bin/ld" => -rwxr-xr-x 2 0 0 834648 Jan  3  2013 
 /usr/bin/ld

 "ps -auwx" => ...
It uses DPaste (https://dpaste.dzfl.pl/) as backend - in fact I tried to re-use most of the code for the example snippet on dlang.org
Dec 19 2016
prev sibling parent Seb <seb wilzba.ch> writes:
On Tuesday, 20 December 2016 at 02:25:06 UTC, Joakim wrote:
 When all tests pass, would be better if it said that, rather 
 than "No output," which it says now.
Excellent idea -> https://github.com/dlang/dlang.org/pull/1527 :)
Dec 19 2016
prev sibling next sibling parent =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Monday, 19 December 2016 at 17:50:17 UTC, Seb wrote:
 I would like to add that this is in an experimental/testing 
 stage and hopefully will get stable with the next release ;-)
Great work, Seb!
Dec 20 2016
prev sibling parent Mark <smarksc gmail.com> writes:
On Monday, 19 December 2016 at 17:50:17 UTC, Seb wrote:
 On Monday, 19 December 2016 at 17:44:29 UTC, Andrei 
 Alexandrescu wrote:
 Take a look e.g. at 
 https://dlang.org/phobos-prerelease/std_algorithm_iteration.html. Examples now
have "Edit" and "Run" buttons that allow you to play with them online and see
what they output. Changes for the ddox version forthcoming.

 Related: https://github.com/dlang/dlang.org/pull/1297, 
 https://issues.dlang.org/show_bug.cgi?id=16984, 
 https://issues.dlang.org/show_bug.cgi?id=16985.

 Many thanks to Sebastian Wilzbach who took this to completion, 
 and to Damian Ziemba for working on the online compiler code!


 Andrei
I would like to add that this is in an experimental/testing stage and hopefully will get stable with the next release ;-)
Awesome.
Dec 23 2016
prev sibling next sibling parent reply Jakub Szewczyk <kubasz51 gmail.com> writes:
On Monday, 19 December 2016 at 17:44:29 UTC, Andrei Alexandrescu 
wrote:
 Take a look e.g. at 
 https://dlang.org/phobos-prerelease/std_algorithm_iteration.html. Examples now
have "Edit" and "Run" buttons that allow you to play with them online and see
what they output. Changes for the ddox version forthcoming.

 Related: https://github.com/dlang/dlang.org/pull/1297, 
 https://issues.dlang.org/show_bug.cgi?id=16984, 
 https://issues.dlang.org/show_bug.cgi?id=16985.

 Many thanks to Sebastian Wilzbach who took this to completion, 
 and to Damian Ziemba for working on the online compiler code!


 Andrei
It looks great, but I think that the source code should not be hidden when pressing the Run button, instead the application output box should appear above/below the source code :-)
Dec 19 2016
parent reply Picaud Vincent <picaud.vincent gmail.com> writes:
On Monday, 19 December 2016 at 18:54:56 UTC, Jakub Szewczyk wrote:

 It looks great, but I think that the source code should not be 
 hidden when pressing the Run button, instead the application 
 output box should appear above/below the source code :-)
+1 Otherwise that is great!
Dec 19 2016
parent reply Soulsbane <paul acheronsoft.com> writes:
On Monday, 19 December 2016 at 19:11:26 UTC, Picaud Vincent wrote:
 On Monday, 19 December 2016 at 18:54:56 UTC, Jakub Szewczyk 
 wrote:

 It looks great, but I think that the source code should not be 
 hidden when pressing the Run button, instead the application 
 output box should appear above/below the source code :-)
+1 Otherwise that is great!
+1 also.
Dec 19 2016
parent reply Seb <seb wilzba.ch> writes:
On Tuesday, 20 December 2016 at 01:34:30 UTC, Soulsbane wrote:
 On Monday, 19 December 2016 at 19:11:26 UTC, Picaud Vincent 
 wrote:
 On Monday, 19 December 2016 at 18:54:56 UTC, Jakub Szewczyk 
 wrote:

 It looks great, but I think that the source code should not 
 be hidden when pressing the Run button, instead the 
 application output box should appear above/below the source 
 code :-)
+1 Otherwise that is great!
+1 also.
Thanks a lot for your feedback! This will hopefully soon be online: https://github.com/dlang/dlang.org/pull/1527
Dec 19 2016
parent reply Johan Engelen <j j.nl> writes:
On Tuesday, 20 December 2016 at 07:04:38 UTC, Seb wrote:
 https://github.com/dlang/dlang.org/pull/1527
Nice. It's pretty awesome! When clicking the "edit" button, a new box appears with the example's code in it but editable. Then when clicking "run", the editted code disappears (it's saved for future use, pfew!). How about this: when clicking _either_ "edit" or "run", the non-editable code box disappears, and the edittable code box appears and stays there forever. (also, the height of the editable-code-box is too small; should fit the whole example's code?) cheers, Johan
Dec 23 2016
parent reply Seb <seb wilzba.ch> writes:
On Friday, 23 December 2016 at 23:52:48 UTC, Johan Engelen wrote:
 On Tuesday, 20 December 2016 at 07:04:38 UTC, Seb wrote:
 https://github.com/dlang/dlang.org/pull/1527
Nice. It's pretty awesome! When clicking the "edit" button, a new box appears with the example's code in it but editable. Then when clicking "run", the editted code disappears (it's saved for future use, pfew!). How about this: when clicking _either_ "edit" or "run", the non-editable code box disappears, and the edittable code box appears and stays there forever. (also, the height of the editable-code-box is too small; should fit the whole example's code?) cheers, Johan
Hehe, that's already in the queue: https://github.com/dlang/dlang.org/pull/1529
Dec 23 2016
parent reply Saurabh Das <saurabh.das gmail.com> writes:
On Saturday, 24 December 2016 at 00:04:54 UTC, Seb wrote:
 On Friday, 23 December 2016 at 23:52:48 UTC, Johan Engelen 
 wrote:
 On Tuesday, 20 December 2016 at 07:04:38 UTC, Seb wrote:
 https://github.com/dlang/dlang.org/pull/1527
Nice. It's pretty awesome! When clicking the "edit" button, a new box appears with the example's code in it but editable. Then when clicking "run", the editted code disappears (it's saved for future use, pfew!). How about this: when clicking _either_ "edit" or "run", the non-editable code box disappears, and the edittable code box appears and stays there forever. (also, the height of the editable-code-box is too small; should fit the whole example's code?) cheers, Johan
Hehe, that's already in the queue: https://github.com/dlang/dlang.org/pull/1529
This is really wonderful. An excellent feature for new users – lowers the cost of "just try it out". Feedback: 1. It will be aesthetically better if the edit/run buttons are inside the code box, say just inside the right top corner. 2. Could we add a "open in an external website/new window" icon/button (for example: http://findicons.com/files/icons/2315/default_icon/256/open_in_new_window.png ) to open the example in say a dpaste window or an equivalent playground. Thanks, Saurabh
Dec 23 2016
next sibling parent reply safety0ff <safety0ff.dev gmail.com> writes:
On Saturday, 24 December 2016 at 06:08:49 UTC, Saurabh Das wrote:
 Feedback:

 1. It will be aesthetically better if the edit/run buttons are 
 inside the code box, say just inside the right top corner.
I agree the button placement should be improved, I think they should be immediately to the right of "Examples:" e.g. "Examples: [Edit][Run]" Which makes it more clear that the examples can be run & edited.
Dec 23 2016
parent safety0ff <safety0ff.dev gmail.com> writes:
On Saturday, 24 December 2016 at 06:15:16 UTC, safety0ff wrote:
 I agree the button placement should be improved, I think they 
 should be immediately to the right of "Examples:"

 e.g. "Examples: [Edit][Run]"

 Which makes it more clear that the examples can be run & edited.
I didn't see that there could be text between the "Examples:" line and the code box. Anyways, I agree with the feedback that the buttons off to the right is difficult to notice.
Dec 23 2016
prev sibling parent reply Seb <seb wilzba.ch> writes:
On Saturday, 24 December 2016 at 06:08:49 UTC, Saurabh Das wrote:
 On Saturday, 24 December 2016 at 00:04:54 UTC, Seb wrote:
 Hehe, that's already in the queue:

 https://github.com/dlang/dlang.org/pull/1529
This is really wonderful. An excellent feature for new users – lowers the cost of "just try it out". Feedback:
Thanks for your feedback :)
 1. It will be aesthetically better if the edit/run buttons are 
 inside the code box, say just inside the right top corner.
Sure - that should be fairly trivial.
 2. Could we add a "open in an external website/new window" 
 icon/button (for example: 
 http://findicons.com/files/icons/2315/default_icon/256/open_in_new_window.png
) to open the example in say a dpaste window or an equivalent playground.
Yes, that would be pretty nice to have. Unfortunately the maintainer of DPaste has been quite unresponsive in the past, so it's not possible with DPaste (e.g. we would need a simple POST API which returns a URL). If someone is planning to reboot sth. like DPaste (e.g. with DUB support, fast caches, ...), please let us know!
Dec 23 2016
parent Saurabh Das <saurabh.das gmail.com> writes:
On Saturday, 24 December 2016 at 06:55:37 UTC, Seb wrote:
 On Saturday, 24 December 2016 at 06:08:49 UTC, Saurabh Das 
 wrote:
 [...]
Thanks for your feedback :)
 [...]
Sure - that should be fairly trivial.
 [...]
Yes, that would be pretty nice to have. Unfortunately the maintainer of DPaste has been quite unresponsive in the past, so it's not possible with DPaste (e.g. we would need a simple POST API which returns a URL). If someone is planning to reboot sth. like DPaste (e.g. with DUB support, fast caches, ...), please let us know!
I was using dpaste as an example. Any website which there's a D playground would work. Infact are there any other that anyone is aware of?
Dec 25 2016
prev sibling next sibling parent unDEFER <undefer gmail.com> writes:
Excellent work, thank you!
Dec 19 2016
prev sibling parent =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Monday, 19 December 2016 at 17:44:29 UTC, Andrei Alexandrescu 
wrote:
 Take a look e.g. at 
 https://dlang.org/phobos-prerelease/std_algorithm_iteration.html. Examples now
have "Edit" and "Run" buttons that allow you to play with them online and see
what they output. Changes for the ddox version forthcoming.
Nice!
Dec 20 2016