<!DOCTYPE html>
<html>
<head>
<title>Minimal SAFE example</title>
<!--
This is added by the SAFE Browser itself, internally:
<script src="maidsafe.js">
--!>
</head>
<body>
<p id="output"></p>
<button id="button">Click me to add a piece of data and then fetch and display it</button>
<script>
function fetchAndDisplayContents()
{
SAFE.getTextFromContainer('my cool blog day 1', function(e)
{
if (e.value)
{
document.getElementById('output').innerHTML = 'Output: ' + e.value;
}
});
}
fetchAndDisplayContents();
document.getElementById('button').addEventListener('click', function(e)
{
SAFE.createTextContainer('my cool blog day 1', 'Today, I made a minimal SAFE example, hoping to transform the current SAFE example from incomprehensible to logical and straight-forward.');
fetchAndDisplayContents();
});
</script>
</body>
</html>
Naturally, this wonât run, because itâs just pseudo code from my basic understanding of what SAFE is and how I want it to be. This is what I expected to see when I loaded the example âweb appâ on the developer site, but instead, I just saw a ton of weird stuff that seems completely alien to me. I truly want to start using this thing, but I literally cannot understand any of the documentation.
It sounds like you want something closer to hello world, than a more advanced Vue based app in the tutorial.
Moreover, it sounds like a wrapper to hide away some of the complexity would help. The tutorial looks to actually create one, but you have to build it from the tutorial. Perhaps this high level functionality should be wrapped into a basic wrapper library?
Perhaps there should be some more simple examples that build up to this? People will be coming into this project at all levels and as it is a new way of writing web apps, starting basic will do no harm.
Personally, I like the way the dev tutorial walks you through creating something reasonably complex. It shows the inner workings, which is useful for building more complex apps. This may not suit how everyone works though and we should be conscious of this.
The goal of this project is to make the #1 EASIEST API for the SAFE Network, so anyone can copy and paste WORKING BUTTONS into their projects / apps / websites.
So itâs not about an API, but about buttons and copy-and-paste-code?
yeah, the api feels like a c wrapper, no classes, the context needs to be passed into functions as an argument.
The Safe-todo-draw Github project has also the index.html that sources the safe.js file that drehb refers to. Like the maidsafe.js that you sourced in your pseudo code in the OP. You can find this index.html easily in the Github project. Iâm not sure if this is what youâre looking for, but maybe it will help (a bit). In safe://todo, there is a Vue.js âlayerâ in between, but you could use safe.js (or something like it) without the Vue.js-part.
So no joke, only drehb who wanted to help you.
We donât seem to be speaking the same language. Whatever I ask or say, I get very strange replies that seem to somehow ignore what I say yet at the same time appear to be answering them. I have no idea what to make of any of this.
Let me just repeat: I have no clue how to code something for SAFE after reading the âexampleâ app.
If you want results, you should try to be more specific about what is not clear to you or what can be improved according to you, I think.
What I think to understand from you is that you find that the Safe example web app should look more like the pseudo code in your OP or something like that.
In the responses you got, other examples than the Safe example web app were mentioned. Examples that maybe resemble more your pseudo code.
And I looked at those, and replied that they arenât. Why even link to them in the first place when itâs no more logical?
I literally have no idea how to use/code for SAFE. How do you think this thing will ever take off if I, who isnât a beginner coder in any sense, have no idea what to do? Itâs almost as if you donât even understand what Iâm talking about.
Frankly I donât. It doesnât make sense to me that you say you are experienced, yet donât appear to be able to say what it is you need help with, and lack the ability to research anything or make any progress despite the resources available, and the people trying to help.
Lots of people have come to this project with little knowledge and experience, and when there where with fewer resources to help they have still managed to get off the ground. One even gave a presentation at the DevCon.
Things are much clearer now and there are people who have been through that trying to help you.
So thereâs a gap here, and as Iâve said, I donât understand what it is and I donât think others here do either.
You saying âIâm experienced and I donât understand any of thisâ isnât working, so maybe you can do better than that. Help others to help you.
You could start by explaining why as an experienced coder you donât understand any of this. Why not? What is your experience? If thereâs nothing you understand, this doesnât make sense, so it leaves people confused as to how to help.
Why canât you make sense of that code? Itâs just code.
Thereâs a problem obviously, but I have no idea what it is, and so no idea how to help you with it. Can you understand that?
There is nothing strange with the sample you suggest @EvilMaid. It is quite normal that heavily used API:s get very simplified, in wrappers or libraries, where some freedom is exchanged for convenience.
The C# code Iâve written to exemplify a SAFENetwork based event store, does exactly this (but in an event sourcing context).
So, your suggestion:
SAFE.getTextFromContainer('my cool blog day 1', function(e)
{
if (e.value)
{
document.getElementById('output').innerHTML = 'Output: ' + e.value;
}
});
This is neat, and this is what it should look like for a large portion of users. But obviously it is not there currently. No need to get so worked up about it.
Personally I think you have a really negative approach. You could say what you want to say, without the passive aggression.
You could just as well have said:
âHey guys! I donât get the examples, I would like to see it like this [your example]. That would make it very easy to understand and use IMO. What do you think? If it doesnât exist, is there anyone out there who would like to do it? I wouldâve loved to do it myself, but canât because of [whatever reason].â
You would have gotten friends immediately here, and maybe also that simplified code. The path to your desired results are much longer now with the approach you chose
OKâŚlet me try to break down the code that I linked for you. You can pretty much use that code directly with a few small modifications to accomplish what you wanted, which I interpreted to be storing and possibly later modifying a string.
on line 11: const SAFE_LIST_KEY = âkey_TodoMVCâ
this is the key that is used to identify the data entry. As you see on lines 47 and 78, this entry is in the userâs public container. You can change line 11 to:
const SAFE_LIST_KEY = âkey_EvilMaidDiaryâ
You should also customize the appInfo on lines 72 - 75.
In your pseudo-code, getTextFromContainer corresponds to GetListEntrySafe in the code that I linked, and createTextContainer corresponds to setList. Add in a call to init when your page loads and you should be well on your way.
Maybe you are such incredible geniuses that you simply cannot understand that not everyone has your vast and deep knowledge about everything, but again, these replies donât make any sense to me, just as that code (Safe-todo-draw/safe.js at master ¡ wardbr/Safe-todo-draw ¡ GitHub) doesnât make any sense.
Is this some elaborate âjokeâ? Are you reading what you want to read instead of what I type? Why is there not a single coherent example on how to use SAFE, or even seemingly any API to use? Why is my example not how you use SAFE? If you want to be taken seriously, things are going to have to change drastically.
I really feel as if Iâm not getting through here. To call it âfrustratingâ would be an extreme understatement. I honestly think that youâve become a very tight group and (perhaps subconsciously) exclude âoutsidersâ by making it impossible to understand the documentation. Iâll just have to take your word for it that some people have allegedly figured it out anyway, but I suspect that is only true for a small handful of people who have followed SAFE from day one.
If you want this project to ever go anywhere, extreme usability for all users, including developers, is an absolute requirement. Iâm not here to tell you what you want to hear, so the SAFE network can be released in year 2040 or something, but what you need to hear if you actually want anyone to make anything for SAFE, because as it stands, it takes skills that almost nobody has.
My serious advice: Get an API finalized and stable ASAP, and make it dead-simple to use without exposing weird, unnecessary internals. Then and only then will anyone besides a handful of hardcore SAFErs care.
So, you want hello world for beginners. I think we all get that and people have tried to bridge that gap for you. I am sure the dev hub will include such examples in the future.
In return, you have been rude and blamed everyone but yourself. Pro tip: if you want help, be modest and respectful to those who can provide it.
Iâve explained why I think weâre finding it impossible to help you.
Youâve responded by repeating the same complaints and adding to them, but have not answered any of my questions which were constructive, designed to shed light and break this deadlock.
This is pointless unless you can engage seriously and constructively.
But since I can tell that you donât want SAFE to succeed, Iâll stop trying to pull out basic documentation from you and let this project fail on its own.
SAFE doesnât exist outside your dream world, but you wonât even admit this when you are old and grey. Youâll still keep chanting the same nonsense.