janpaul123 / paperprograms

Run Javascript on pieces of paper!
https://paperprograms.org
MIT License
498 stars 54 forks source link

Program export / import #34

Closed sgwilym closed 6 years ago

sgwilym commented 6 years ago

Here's something that I've been thinking about contributing, but would like to gauge how others feel about it before implementing it.

Right now all programs are saved to local storage, which has the downside of tying your programs to one device. This is fine if you have a single (portable) computer, but I've already encountered a few scenarios where I'd like to load programs on a different machine and been faced with copying and pasting code over, and having to re-print all the programs.

I also feel like it'd be best if a feature like this would be out of the way and limited in what it can do so as to keep the emphasis on the physical sharing of code. It'd really just be for the scenario of 'I want to plug in the projector and camera into a different machine but keep the programs I have'.

Here's what I was thinking: Add a new page at something like /storage.html, which presents two options:

Would this work as I think it would, or am I overlooking something? Would this be useful to others?

ajbouh commented 6 years ago

It would be interesting if there were a QR code that established the "namespace" for all programs. Then you could just scan the QR code (perhaps printed on the back of your papers, or on an additional one) to switch over to a specific namespace.

On Thu, Mar 22, 2018, 04:44 Sam Gwilym notifications@github.com wrote:

Here's something that I've been thinking about contributing, but would like to gauge how others feel about it before implementing it.

Right now all programs are saved to local storage, which has the downside of tying your programs to one device. This is fine if you have a single (portable) computer, but I've already encountered a few scenarios where I'd like to load programs on a different machine and been faced with copying and pasting code over, and having to re-print all the programs.

I also feel like it'd be best if a feature like this would be out of the way and limited in what it can do so as to keep the emphasis on the physical sharing of code. It'd really just be for the scenario of 'I want to plug in the projector and camera into a different machine but keep the programs I have'.

Here's what I was thinking: Add a new page at something like /storage.html, which presents two options:

  • A 'Download programs' button that would export the programs in local storage to a zipped JSON blob.
  • An 'Replace programs' input that would take one of these archives and use it to replace all the programs in local storage, meaning we can safely keep the program IDs and keep their paper counterparts working.

Would this work as I think it would, or am I overlooking something (especially regarding IDs)? Would this be useful to others?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/janpaul123/paperprograms/issues/34, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAcnRQ2fWCDrK_EFNVFC9rGzhptrOKqks5tg45-gaJpZM4S25n6 .

janpaul123 commented 6 years ago

Right now all programs are saved to local storage, which has the downside of tying your programs to one device. This is fine if you have a single (portable) computer, but I've already encountered a few scenarios where I'd like to load programs on a different machine and been faced with copying and pasting code over, and having to re-print all the programs.

Well they're also stored on the server. If you use paperprograms.org, all you have to do is copy/paste the "space url" in the top right.

It would be interesting if there were a QR code that established the "namespace" for all programs.

Maybe we can start with just printing the "space url" on the paper? What do you think?

sgwilym commented 6 years ago

Well they're also stored on the server. If you use paperprograms.org, all you have to do is copy/paste the "space url" in the top right.

Oh. That's what that field is for! I always copied the link from there, pasted it into the browser and thought 'oh neat, an endpoint to expose the space data to other clients!' 😅

I do think there are improvments that could be made to the UI to make it clear that this isn't just a widget exposing a string for you to paste elsewhere, but a value that you can change. It also seems very prominent for something that is probably not changed very often.

What if I made a PR for a UI change like this?

programming - 2018-04-30 12 57 30

Maybe we can start with just printing the "space url" on the paper? What do you think?

This is also a good way to prevent space names from being lost. 👍

sgwilym commented 6 years ago

Also if you change the space, doesn't that mean you can edit the programs of that space too?

janpaul123 commented 6 years ago

What if I made a PR for a UI change like this?

That looks awesome! Great idea, would merge. 😉

Also if you change the space, doesn't that mean you can edit the programs of that space too?

Yep. That's why by default a somewhat unique space id is generated, so that it's not easily guessable. In any case, if someone decides to mess with your space by editing programs, you can always restore them back to their original versions. ☺️

janpaul123 commented 6 years ago

Another idea: it might be nice to also store the configuration on the server, so you don't have to completely recalibrate when you switch computers / browsers / etc.

ajbouh commented 6 years ago

You could even make the "key" for the space a QR code that's printed out and (when visible) it replaces all state/config/calibration.

On Sat, May 5, 2018, 13:49 Jan Paul Posma notifications@github.com wrote:

Another idea: it might be nice to also store the configuration on the server, so you don't have to completely recalibrate when you switch computers / browsers / etc.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/janpaul123/paperprograms/issues/34#issuecomment-386833898, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAcneFbWheH34yRg3MGptMh_TPRWkYDks5tvhBSgaJpZM4S25n6 .