Web development like PB-programming

Just starting out? Need help? Post your questions and find answers here.
soerenkj
User
User
Posts: 95
Joined: Mon Jun 14, 2004 10:19 pm

Web development like PB-programming

Post by soerenkj »

Is there some 'PureBasic-like' way to make a website??
I dislike with PHP/ASP that I have to manually maintain state between each time the page is rendered, and with .NET I don't like that I can't just use Windows API but have to learn a big Object Oriented API.
Basically I would like to be able to make an application like I would normally do with PureBasic and then just have the main window shown inside a webpage..
Hydrate
Enthusiast
Enthusiast
Posts: 436
Joined: Mon May 16, 2005 9:37 pm
Contact:

Post by Hydrate »

To me what you want to do sounds complicated, you could make an exe, and have pb dl the exe and then load it in a window in a pb app, but that is long winded and the filesize would be large, thats my idea anyway...or make your own simple script and have purebasic decode it...
fweil
Enthusiast
Enthusiast
Posts: 725
Joined: Thu Apr 22, 2004 5:56 pm
Location: France
Contact:

Post by fweil »

I experimented full PB web site using one program as the web server and another to process some requests (cgi method).

It is possible to do, and the documentation and many posts here will give solutions.

I did never compare this to other solutions about performances.

Just I found that it was running well and did not overlaod memory and CPU.
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
rich
New User
New User
Posts: 6
Joined: Thu Oct 30, 2003 8:20 pm
Location: UK
Contact:

Post by rich »

I dislike with PHP/ASP that I have to manually maintain state between each time the page is rendered
Welcome to the HTTP protocol.

It is an *entirely* stateless protocol and, well, there's nothing you can do abot that. Which is why PHP/ASP/Perl/Ruby/etc all handle sessions server side and force some semblance of state in that manner.

Any "PureBasic" style approach would have to do exactly the same.
soerenkj
User
User
Posts: 95
Joined: Mon Jun 14, 2004 10:19 pm

Post by soerenkj »

With .NET you do not have to worry about remembering the state of the user interaction with the session variables that you use in PHPO/ASP - you can program as if the interaction with the user did not occur over a network, and that's what I like about .NET - what I don't like is that I have to learn a whole new Object Oriented API now that I'm finaly starting to get a grasp of the Windows API..
I'm not looking to do something specific, I just want an easier way of making websites - the way that PB is easier than Visual Studio.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Not sure why using ASP session (or plain old cookies) isn't the answer for you. A simple check on session variable can ensure "state" is maintained, and the check can be in an include file you just shove into each script.

Or did I miss something?

Anyhow, PB can be used as you suggest. Not sure if this is still the case, but I think Paul of PureVision fame ran his entire (very interactive) website using PureBasic.

Also, IIRC, there are some CGI examples and/or libs floating around on Pauls site, or PureArea, or perhaps in these boards. With solid authors like, again IIRC, Paul and El_Choni and etc.
@}--`--,-- A rose by any other name ..
soerenkj
User
User
Posts: 95
Joined: Mon Jun 14, 2004 10:19 pm

Post by soerenkj »

Not sure why using ASP session (or plain old cookies) isn't the answer for you. A simple check on session variable can ensure "state" is maintained
but for a little more complex applications you can end up doing a lot of these simple checks across a lot of pages = a mess. That's why it's neat with .NET that you can make a web site they way that you normally make an application.

if you were making a web site as a server written in PB, I think you might have the same problems about maintaing states.
but anyway, maybe it is possible to run a PB program from the browser.. but then there might be some security problems..
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

am i entirely missing the point, or are you talking about creating a purebasic webserver, ie. handling calls on port 80 directly?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post by Rescator »

As far as I understand, .NET autotrack user/sessions, and autoflush them after a certain timeout.

There is several ways to carry data between "pages".

Using the url itself to carry variables,
using cookies,
using sessions.

All 3 can be mixed in various combinations too.

By url is a "by call" method, client side only storage.
Cookies is a "by request", client side only storage,
and Session is "by server", server side storage only.

If you are thinking of Java applets or Flash or similar,
they too can make use of sessions and cookies,
but in those cases most (and sometimes all) data is tracked on the client.

Running PureBasic embed would be a major security headache
as it wouldbasicaly be executing native code on the users client system.
Personaly I'd never allow anything like that, and would never trust such a website.

There are ways to make use of sessions wether they are stored on disk,
in memory, or in a database (my favourite),
and base the sessionid/info on the user ip, date+time, + a unique value (to prevent spoofing),
use cookies to let the browser store it, and after say... an hr or so of inactivity delete the session thus making the cookie invalid.
The cookie only holds the sessionid (altogh you can store other data with it),
the sessionid stored on the server could in addition (why I love database storage) hold either variable fields, or even serialized php arrays.

My own favourite is creating a single global var that the main script and all other scripts use, and keep all data (vars or even nested arrays) in that global array, and then use PHP's serialize and unserialize functions to store the state.

All you would have to do at the start of a session is to check if a session is active or if it is a new session.
If a old session then fetch th serialized data from the database,
and at the end of the script (or when you wish to store the data so far) use serialize and store it in the database.

I'm pretty sure that .NET uses a similar way, and I suspect that .ASP has similar features too. (either automatic or semi-automatic)
And as you can see, it's not that hard to do it with PHP either.
You can even use two arrays or types of serializing,
one session only (to carry data from page to page)
and one longterm one that is "remembered" until next time the user pops by. (only truly usefull for member sites, or in cases with long term cookies)

There are other ways too though, but you need a custom browser to do that, and there could be a few security issues if not done properly.
With PHP it is very easy to create and read custom HTTP headers,
and you can easily use the header to transfer info.
In fact, that is exactly how cookies work btw.
So I suggest you rely on client side cookie for sessionid and serialized arrays or vars for "solid session" stuff.
soerenkj
User
User
Posts: 95
Joined: Mon Jun 14, 2004 10:19 pm

Post by soerenkj »

hi. Thanks for the advice. I need to study web development some more.. (still haven't decided if I should use .Net og PHP)
KameHameHaaa
User
User
Posts: 19
Joined: Wed Oct 05, 2005 2:44 pm

Post by KameHameHaaa »

In the company where I work, we build large and complex projects (CMS, CRM, DB with millions if records, all AJAX based) with great results. In PHP.
All is needed is competency and a good language (PHP, javascript, SQL).

just my 2 euro-cents.
soerenkj
User
User
Posts: 95
Joined: Mon Jun 14, 2004 10:19 pm

Post by soerenkj »

.net is better and of course more difficult.
from the advertisements I got the impression that .NET was better primarily because it was easier to use..
Edwin Knoppert
Addict
Addict
Posts: 1073
Joined: Fri Apr 25, 2003 11:13 pm
Location: Netherlands
Contact:

Post by Edwin Knoppert »

Mwah, there is still a steep learning curve.
The easy parts are intellisense and the fact about any issue is dealt with in the framework.

ASP.NET allows you to use any ordinary dll declaration, so the remark it doesn't support winapi is not right.
But isn't really required and logical.
I use a few winapi's to load a custom dll.

Note that even if you don't want to do a form of asp, even preparing and using aspx files will benefit you later.
It's pretty obvious you'll at some point want a specific functionality.
Well it's there *right away* (!)

Don't think of ASP, which is totally different from ASP.NET, but html lay-out can be 99% the same as you used to do.
( A minor issue, a single line declaration is required per aspx file)
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Post by ricardo »

Edwin Knoppert wrote: ASP.NET allows you to use any ordinary dll declaration, so the remark it doesn't support winapi is not right.
But isn't really required and logical.
I use a few winapi's to load a custom dll.
Really?

Thats very nice and interesting!!

Dlls coded in PB?

Can you explain a little more abot that please?

Thanks in advance
ARGENTINA WORLD CHAMPION
Edwin Knoppert
Addict
Addict
Posts: 1073
Joined: Fri Apr 25, 2003 11:13 pm
Location: Netherlands
Contact:

Post by Edwin Knoppert »

Locked