Posts: 9147
Threads: 83
Joined: May 22, 2013
Reputation:
46
RE: PicoBlaze Simulator in JavaScript
August 23, 2022 at 6:04 pm
(This post was last modified: August 23, 2022 at 6:17 pm by bennyboy.)
(August 23, 2022 at 2:33 pm)FlatAssembler Wrote: bennyboy Wrote:Free hosting is bullshit. I hate it. What makes you say so? I say so because free hosting of sites involving data access (uploading or downloading media, etc.) are horribly slow and unreliable-- or, I should say, they were when I attempted to put my first small business website online. The experience of using "free" sites was so traumatizing that I pulled out my wallet and signed up for a Microsoft VM-- quite expensive, but fast as hell and always works perfectly. It's different when you are a student, though. I get it.
Quote:So, how is Firebase different from GitHub Pages? I watched the video and I failed to understand what does one gain by using FireBase instead of GitHub pages for WebAssembly.
I couldn't tell you. As I said, I've seen these things around, but have not used them, as I use Azure services exclusively.
Quote:I already have a static-file hosting service, that is GitHub Pages, I want to build and deploy a back-end, so that people can share and comment on their own PicoBlaze programs.
You don't need to be stuck with one app or one framework or physical system. If you want something more active, then use a static site (i.e. the one you already have) and write an API in whatever language, using whatever framework, you want, for the dynamic content-- so long as your free host will allow you to pass data in and out, you can bypass all the ads and other BS.
A typical API will be very small: usually taking in JSON, parsing it, and making a SQL query to save or update data-- or making a SQL query and sending it out as JSON. Your main site doesn't really care where that JSON data is coming from, as they are decoupled.
Posts: 2020
Threads: 133
Joined: July 26, 2017
Reputation:
5
RE: PicoBlaze Simulator in JavaScript
August 24, 2022 at 7:18 am
bennyboy Wrote:I say so because free hosting of sites involving data access (uploading or downloading media, etc.) are horribly slow and unreliable I don't mean to upload or download media. I mean to upload and download small text files.
bennyboy Wrote:A typical API will be very small: usually taking in JSON, parsing it The list of examples is already stored in as JSON, it is fetched and parsed as this:
Code: fetch("https://flatassembler.github.io/PicoBlaze/examples.json")
.then((response) => {
if (!response.ok)
throw new Error(response.status);
else
return response.text();
})
.then((jsonFromGithub) => {
const examplesArray = JSON.parse(jsonFromGithub);
let examplesHTML = examplesArray
.map((example) => `
<div class="exampleCodeLink" onclick="fetchExample('${example.file_name}')">
<img
src="${example.image}"
alt="${example.image_alt}"
/>${example.name}
</div>
`).join("") + `
<div class="exampleCodeLink" style="display: flex">
<div class="callForMoreExamples">
Maybe you'd like to try <a href="https://flatassembler.github.io/Duktape.zip">my examples of x86 assembly</a>,
that <a href="https://flatassembler.github.io/AEC_specification.html#HowToCompile">AEC compiles</a> to?
</div>
</div>
<div class="exampleCodeLink" style="display: flex">
<div class="callForMoreExamples">
Have some example you would like to add here?
<a
href="https://github.com/FlatAssembler/PicoBlaze_Simulator_in_JS/issues"
>Contact me on GitHub</a
>!
</div>
</div>
<div style="width: 1px; flex-shrink: 0">
<!--
Because, apparently, CSS ignores the right-margin on flex
elements that cause overflow.
-->
</div>
`;
document.getElementById("examples").style.justifyContent = "initial";
document.getElementById("examples").style.alignItems = "initial";
document.getElementById("examples").innerHTML = examplesHTML;
})
.catch((error) => {
document.getElementById("fetchingExamples").innerHTML =
"Failed to fetch the examples JSON from GitHub: " + error;
});
Posts: 9147
Threads: 83
Joined: May 22, 2013
Reputation:
46
RE: PicoBlaze Simulator in JavaScript
August 24, 2022 at 7:43 am
(This post was last modified: August 24, 2022 at 7:49 am by bennyboy.)
(August 24, 2022 at 7:18 am)FlatAssembler Wrote: bennyboy Wrote:I say so because free hosting of sites involving data access (uploading or downloading media, etc.) are horribly slow and unreliable I don't mean to upload or download media. I mean to upload and download small text files. I wasn't explaining why YOU shouldn't use free hosting. I was explaining why I don't have any experience doing what you are doing-- because I already have a paid server.
Quote:bennyboy Wrote:A typical API will be very small: usually taking in JSON, parsing it
The list of examples is already stored in as JSON Fine. So you should easily be able to use a free server site to store examples either by inserting into a .json file, creating multiple files, or saving them to a mySQL database, and reveal CRUD methods through an API-- which you should be able to call from JavaScript in your static files site.
Posts: 46748
Threads: 544
Joined: July 24, 2013
Reputation:
108
RE: PicoBlaze Simulator in JavaScript
August 25, 2022 at 3:59 am
Boru
‘I can’t be having with this.’ - Esmeralda Weatherwax
Posts: 9147
Threads: 83
Joined: May 22, 2013
Reputation:
46
RE: PicoBlaze Simulator in JavaScript
August 25, 2022 at 7:33 am
(This post was last modified: August 25, 2022 at 7:34 am by bennyboy.)
@ BrianSoddingBoru4
That lady's Eve's Apple is quite large.
Posts: 2020
Threads: 133
Joined: July 26, 2017
Reputation:
5
RE: PicoBlaze Simulator in JavaScript
August 31, 2022 at 7:12 am
(August 25, 2022 at 3:59 am)BrianSoddingBoru4 Wrote:
Boru Isn't posting such off-topic comments against the rules?
Posts: 9147
Threads: 83
Joined: May 22, 2013
Reputation:
46
RE: PicoBlaze Simulator in JavaScript
August 31, 2022 at 11:13 am
(August 31, 2022 at 7:12 am)FlatAssembler Wrote: Isn't posting such off-topic comments against the rules?
Yeah, seemed kind of rude and inappropriate to me, too.
Posts: 2020
Threads: 133
Joined: July 26, 2017
Reputation:
5
RE: PicoBlaze Simulator in JavaScript
September 2, 2022 at 12:59 am
(August 31, 2022 at 11:13 am)bennyboy Wrote: (August 31, 2022 at 7:12 am)FlatAssembler Wrote: Isn't posting such off-topic comments against the rules?
Yeah, seemed kind of rude and inappropriate to me, too.
I mean, the comments complaining about me supposedly asking for help with my homework are not answering the question, but are at least slightly on-topic. This is just completely off-topic.
Posts: 2020
Threads: 133
Joined: July 26, 2017
Reputation:
5
RE: PicoBlaze Simulator in JavaScript
September 14, 2022 at 9:31 am
I have started a Reddit community about PicoBlaze: https://reddit.com/r/PicoBlaze
Let's hope I will be able to manage it.
Posts: 2020
Threads: 133
Joined: July 26, 2017
Reputation:
5
RE: PicoBlaze Simulator in JavaScript
June 23, 2023 at 5:03 pm
What do you guys think, why was Firefox not allowing me to `fetch` the JSON list of examples from `raw.githubusercontent.com` (which is why I had to copy that JSON from my GitHub profile to my website in order to be able to fetch it from my PicoBlaze Simulator), but it allows me to `fetch` the `.psm` files from `raw.githubusercontent.com`? I have asked an Information Security StackExchange question about that.
|