Page 1 of 2

PB to SB Conversion Q's

Posted: Mon Jun 24, 2019 7:33 am
by saboteur
I have an ERP application written in PB and would like to convert it to SB.

In an affort to keep code managable, each option is a individual program ( there are over a hundred ) that is called from a main menu program using RunProgram and this suits my needs admirably.

However, I don't see this being available within SB, so how would i achieve a similar result ?

Obviously, it's heavily dependant on mysql/mariadb read/writes and I assume the way to acheive this is via PHP scripts acting as a go between, but haven't seen many examples of this.

I also rely on the listicongadget, but have to use the webgadget and html tables ( becasue i need variable row heights ) how can this be acheived in SB ?.

I will also need a way to produce printed reports, but understand this lwill probably need some sort of PDF output - has this been tried by anyone ?

Finally, one of my frustrations with PB is tha inability to Format the theme of the window ( Title bar mainly ), is this possible at all in SB ?

Sorry for all the q's, but I'd really like to keep my work in the PB family :mrgreen:

Cheers

Re: PB to SB Conversion Q's

Posted: Tue Jun 25, 2019 7:18 am
by the.weavster
saboteur wrote:In an affort to keep code managable, each option is a individual program ( there are over a hundred ) that is called from a main menu program using RunProgram and this suits my needs admirably.

However, I don't see this being available within SB, so how would i achieve a similar result ?
You can find an example of breaking event loops down to a window by window basis here
saboteur wrote:Obviously, it's heavily dependant on mysql/mariadb read/writes and I assume the way to acheive this is via PHP scripts acting as a go between, but haven't seen many examples of this.
Why not use PureBasic's CGI commands? I'd recommend JSON-RPC for sending the data back and forth. That also matches your brief of preferring small discrete programs.
saboteur wrote:I also rely on the listicongadget, but have to use the webgadget and html tables ( becasue i need variable row heights ) how can this be acheived in SB ?.
Peter has created a wrapper for Tabulator which you can find here
saboteur wrote:I will also need a way to produce printed reports, but understand this lwill probably need some sort of PDF output - has this been tried by anyone?
I don't know if this is of any interest but you can use Valentina Reports from PureBasic. There's an example here

Re: PB to SB Conversion Q's

Posted: Tue Jun 25, 2019 8:09 am
by saboteur
Thanks for the reply and info, it is very helpfull.
the.weavster wrote:
saboteur wrote:In an affort to keep code managable, each option is a individual program ( there are over a hundred ) that is called from a main menu program using RunProgram and this suits my needs admirably.

However, I don't see this being available within SB, so how would i achieve a similar result ?
You can find an example of breaking event loops down to a window by window basis here

I can't understand this part however. Is it not possible to have individual programs that can call each other and pass variables between them in spiderbasic ?

It's not possible for me to merge all my code into one large block, it would be unmaintainable, a nightmare to debug, and a 100,000+ lines of code.

My understanding of this is not clear, but with PHP i could set session variables etc and pass those between scripts, and i'm sure i can knock something similar up storing 'session' variables' in a local db, but wanted to check if this is something SB has built in.

As an aside, is there a write up on deployment of SB programs, the manual is a bit vague imho.

Anyhoo, thanks again.

Re: PB to SB Conversion Q's

Posted: Tue Jun 25, 2019 1:58 pm
by the.weavster
saboteur wrote:Is it not possible to have individual programs that can call each other and pass variables between them in spiderbasic ?
It's not possible for me to merge all my code into one large block, it would be unmaintainable, a nightmare to debug, and a 100,000+ lines of code.
You can have each individual window and its associated event handlers in separate files so it's not all in one big block.
saboteur wrote:My understanding of this is not clear, but with PHP i could set session variables etc and pass those between scripts, and i'm sure i can knock something similar up storing 'session' variables' in a local db, but wanted to check if this is something SB has built in.
SpiderBasic creates single page web apps so there's very little need for server side session variables beyond maybe just a session token to show a client has logged in successfully.

Re: PB to SB Conversion Q's

Posted: Tue Jun 25, 2019 2:34 pm
by saboteur
the.weavster wrote:
saboteur wrote:Is it not possible to have individual programs that can call each other and pass variables between them in spiderbasic ?
It's not possible for me to merge all my code into one large block, it would be unmaintainable, a nightmare to debug, and a 100,000+ lines of code.
You can have each individual window and its associated event handlers in separate files so it's not all in one big block.
.
Again thanks for the reply.

I'm sorry but i still dont understand, do you mean like an (x)include in PB ? or some other method ? do you have an example.

If i can figure this out I think i'll be confident in converting to SB.

Cheers

Re: PB to SB Conversion Q's

Posted: Wed Jun 26, 2019 7:33 am
by the.weavster
saboteur wrote:I'm sorry but i still dont understand, do you mean like an (x)include in PB ?
On the server side your CGIs could be discrete small programs that take care of a particular task. Client side... I suppose you could have a 'menu' page that is just a set of links to small SpiderBasic apps but personally I think I'd use XIncludeFile to bring all windows together into one app.

Re: PB to SB Conversion Q's

Posted: Wed Jun 26, 2019 11:38 am
by Dirk Geppert
If you want to develop SB and PB in one project, you should take a look at Peter's SpiderByte.

https://github.com/spiderbytes/SpiderBite

II personally work with it, on all my client server projects - it's great!

Re: PB to SB Conversion Q's

Posted: Fri Aug 09, 2019 9:59 am
by bbanelli
I know this is an old topic, but I would strongly discourage using (any, let alone PB's) CGI in 2019.

Instead, for server side, consider GoLang. It is not OO, it is modern but very human readable (like PB), and you can pack whole SB app in it and deploy it on any PaaS/SaaS platform (Heroku, Docker...). If you are accustomed to PB syntax and way of thinking, you will adore Go!

Go's built in HTTP server can serve SB files and handle backend perfectly.

Re: PB to SB Conversion Q's

Posted: Fri Aug 09, 2019 1:09 pm
by Peter
bbanelli wrote:Instead, for server side, consider GoLang.
Consequently, you would have to use GopherJS or the Joy Compiler now. ;)

Re: PB to SB Conversion Q's

Posted: Fri Aug 09, 2019 9:27 pm
by the.weavster
bbanelli wrote:I know this is an old topic, but I would strongly discourage using (any, let alone PB's) CGI in 2019.
Why? CGI is wonderfully simple and simple solutions are invariably the most robust.