Author Topic: BASIC Anywhere Machine as tiny sidekick for QB64  (Read 2786 times)

0 Members and 1 Guest are viewing this topic.

Offline CharlieJV

  • Newbie
  • Posts: 89
    • View Profile
BASIC Anywhere Machine as tiny sidekick for QB64
« on: February 05, 2022, 05:17:58 pm »
G'day all,

I don't intend on making a habit of discussing this little project of mine here unless I ever add anything noteworthy that is about enhancements directly related to compatibility with QB64.  To not distract from the goodness that is QB64, if you want to get in touch with me about the project, see links at the end of this post.

BASIC Anywhere Machine: an all-in-one HTML file (a TiddlyWiki instance) hosting a customised version of wwwBASIC and hosting BASIC programs (as TiddlyWiki "tiddlers"), and providing an IDE user interface layer on top of TiddlyWiki.

Although this thing will never be fully compatible (maybe just somewhat compatible) with QB64, I think it might be useful to QB64 programmers as a little sidekick.

Aside: why not fully compatible?  Well, it is BASIC running in a web browser.  I can't imagine this thing every being adequate for large programs, and I can imagine the javascript involved to interpret BASIC programs can only get so big before BASIC Anywhere Machine starts breaking.  And I loathe javascript, so I am limited to just doing some simple things with that brutal language, resulting in only simple things going into this BASIC implementation.

How can it be useful as a QB64 sidekick?  Of the mess of intertwingled thoughts swirling in this old sponge, I can manage to express these:

  • PORTABILITY!  Cranking out and testing small pieces of BASIC code anywhere (online, offline, on any device ... you just need a web browser)
  • As a repository for often used source code (BASIC Anywhere Machine is a TiddlyWiki instance, and like any Wiki, it offers a ton of flexibility regarding organisation of programs (in tiddlers), tagging those tiddlers, documentation, searching, formatting search results, yadda yadda yadda all the goodness that is TiddlyWiki
  • (30 minutes later after-thought) For simple QB64 programs that are compatible with BASIC Anywhere Machine: ability to deploy the program as a single HTML file that contains only the program and the javascript interpreter, to run the program in any web browser, the results of the program showing in a console window in a web page.

If there are some simple QB64-friendly things I can do to this critter that is BASIC Anywhere Machine, I am really game to take requests (comments/questions, etc.) via this form.  I might setup a Google Group for that.  (Yeah, it has warts, but it is ridiculously simple.)

Cheers!
« Last Edit: February 05, 2022, 05:53:43 pm by CharlieJV »

Offline madscijr

  • Seasoned Forum Regular
  • Posts: 295
    • View Profile
Re: BASIC Anywhere Machine as tiny sidekick for QB64
« Reply #1 on: February 08, 2022, 11:36:39 pm »

BASIC Anywhere Machine: an all-in-one HTML file (a TiddlyWiki instance) hosting a customised version of wwwBASIC and hosting BASIC programs (as TiddlyWiki "tiddlers"), and providing an IDE user interface layer on top of TiddlyWiki.

Interesting... I used to play with TiddlyWiki way back when, and it was pretty neat. Alas, browser security changes made it harder to run, and then they changed everything with TW5 and I just fell out of it. But the way it worked as a document database where you could run live code to transform and filter your info was hugely useful for a time! Did they ever get a WYSIWYG editor that supported pasting in rich text, tables, etc. (Like how you can paste into OneNote or Word)? I recall Web security placed lots of limits on accessing the clipboard. Also, writing custom plugins was a little tricky for those of us more at home with BASIC rather than JavaScript and especially the object model. But it was neat that it could be done. So you can write plugins and manipulate tiddlers for a TW in BASIC?

Offline CharlieJV

  • Newbie
  • Posts: 89
    • View Profile
Re: BASIC Anywhere Machine as tiny sidekick for QB64
« Reply #2 on: February 09, 2022, 01:24:29 pm »
G'day,

I only discovered TiddlyWiki a few years ago, and not familiar at all with TiddlyWiki Classic.  I only know TiddlyWiki 5 (aka TW5), so I can't get much into any of the before and afters.

The bare-bones product uses markup with a side-panel preview.  I can't stand markup, but the filtering capabilities and the implementation of transclusion are so good, I don't mind suffering markup.  It doesn't (natively) have the smooth "drag and drop things" of OneNote (or "Notion", which is to me a better OneNote), but not having proper transclusion is a deal-breaker for me.  (Aside, this article beautifully explains how I operate all of the time.  Can't get componentization without proper transclusion implementation.)  The TiddlyWiki community is very active, and there are all kinds of folk who have created really great plugins that might handle these things.  I wouldn't know.  I largely avoid plugins because I rather like creating things myself.

As a "anything" database (GTD solution, documentation, zettelkasten notes, tracking citations, you-name-it,) TiddlyWiki rocks something silly.  For something so diminutive.

You might find Grok TiddlyWiki worth a visit or two on sanity/insanity breaks.

Me, I call TiddlyWiki a "Development Platform for Hyperlinked Solutions."  (Example creations of mine below.  Too many interests, so little time, and attention regulation disability: I'm often bouncing between things, and so many things gathering dust as I chase down the most interesting thing at the moment.)

The way I've implemented BASIC in TiddlyWiki, TiddlyWiki dynamically puts together the HTML (wwwBASIC javascript, BASIC program) and feeds it to an iframe.  So the TiddlyWiki and the BASIC program know nothing of each other.  That's a good thing, I think (good luck me explaining why.)

My way (development in progress) around the two not seeing each other: web browser's local storage.  I've got TiddlyWiki "javascript macros" (a pain to create/maintain, I find) that let the TiddlyWiki read/write from/to local storage, and I've added function/statement to wwwBASIC that reads/writes from/to local storage.  So now the two can "talk" to each other.  So this opens up the possibility of using BASIC for scripting in TiddlyWiki.  TiddlyWiki filtering operations are wickedly good on their own, but there are certain things that might be much easier to do with BASIC.  Proof of concept (ridiculous use case): check out this TiddlyWiki instance.

The clipboard is another possibility for transfer.  I've got a "SetClipboardText" statement in BASIC Anywhere Machine now, as a way to send a string of text (which can be thousands of characters in length) to the clipboard for pasting anywhere else.  Maybe a "GetClipboardText"  function for BASIC, and adding SetClipboardText and GetClipboardText javascript macros in TiddlyWiki could be handy.

So BASIC can't manipulate the tiddlers themselves, but can easily generate TiddlyWiki content (widgets, filters, etc.) that show in tiddlers.  For example, BASIC could dynamically create a button that then appears in a tiddler, and does something related to that tiddler when pressed.  Ooooo, the possibilities ...

But all of that aside: the thing that gets my mojo going is the thought of BASIC Anywhere Machine for creating/testing/maintaining/storing/documenting bits of QB64 code (within reasonable limits).  One dedicated BASIC Anywhere Machine instance per significantly sized QB64 project, and/or a BASIC Anywhere Machine instance with common/standard stuff for all QB64 projects.  I'm totally geeking out on that use case.

Oops, I got wordy.  If only you knew how much worse things could have been if you also had to suffer all of my non-verbal communication...

Cheers !

Some of my TiddlyWiki projects: