+ 8
Can we store data on SoloLearn?
Just wanted to know if raw data can be stored either on SoloLearn servers, or by linking it with local server(my phone's memory).(for code development purposes only).Thanks!
7 ответов
+ 6
SoloLearn deletes + terminates everything related to your application once a timeout expires (so, no). You can create files and save data there but you have a very short window in which to work with them.
You can save files in (example) /sdcard/devs and then use it like this:
HTML (src/hrefs/etc): <script src="file:///sdcard/devs/js/myjavascript.js" >
Web Browser (address): file:///sdcard/devs/ (to browse, find things, copy 'links')
Inside other code: /sdcard/devs/...
Notes/caveats:
There are THREE slashes for web protocols, TWO for the protocol (file:// .... it's like http://) and one for the beginning of the path: /
Android may helpfully switch your path to /storage/emulated/0 (instead of /sdcard) - just switch it back if you get security violations.
Javascript will be cached by SoloLearn (you reload but nothing changes).
To get around local caching, you can:
<script src="file:///sdcard/devs/js/myjavascript.js?cachebuster=1" >
where you update the "cache buster"* number every time you save "myjavascript.js" in an external IDE like DroidEdit, etc.
* Visitors: This is a URL parameter (but there's nothing to care about it so it's safe). People usually use time() + date() here to ensure the number is unique every run. Manual way is shown.
+ 6
Thanks Kirk...but can I also do it on Java or CPP?
+ 6
okay...thanks!
+ 5
Java and C++ look on the server (vs. local AIDE and CppDroid apps). Since there's no real persistence you'd have to pull/send the data in every time; so you may need threading and still not be fast enough.
+ 5
Python.. is a good option... But I'll have to learn it first :'(
+ 5
Don't worry; it's not at all like trying to tame a snake :)
+ 3
For Python you could avantageously and easily install an android app like QPython/QPython3 which provides interpreter to run Python scrpts and/or command line interpreter... through wich you can access to local storage, and run script in true real-time interactive input/output, unlike SoloLearn Code Playground :P