Help with Putting DB on Web

I have started a project to collect data about how far electric cars actually go. The EPA publishes figures on driving range, but I have found that these ranges are unrealistic. My carfare example, has a published EPA driving range of 326 miles, but my actual experience has been 252 miles. I would like to collect data for many different car models over different seasons and driving conditions. To do this, I have set up a PanX database that is accessible on the internet for input. But I have no idea how to do this.

Would anyone be willing to help with this project? Attached is an input form showing the data that I would like to collect.

1 Like

As a Panorama web developer and an EV owner I’d be interested in getting involved to some degree.

I’ve agreed to get involved and will be helping Tom with this project.

For those who are interested, here are the steps as I see them:

To get your database(s) accessible online, there are a few basic requirements to get started.

The databases must be published for the web. See Introduction to Panorama X Team Server

Once your databases are published and working, you need to establish the means to contact them via browser, generate a response, and in some cases process any returned information.

Panorama includes what I consider to be a remarkable ability to handle all of this for you. The overall documentation for “Web” remains under construction, but just search the Help file for “render” and you’ll find a number of useful links both in the sidebar and in the See Also links at the bottom.

Personally, I’ve long preferred to build my own HTML pages, creating templates that I can reuse and edit constantly. It’s not that hard, but obviously, some knowledge of HTML is necessary. Pages can be built in a web design program such as Dreamweaver, then modified as necessary for merging data from a Panorama database.

And finally, you need a static IP address if you want the outside world to be able to regularly connect to your databases.

I’m going to follow up with more posts and a bit more step-by-step on the above. Tom has agreed to the idea of me sharing this info as I work with him to bring this interesting project to fruition.

( Fun fact: I built my first responsive Panorama apps for the web in 1996 and have never stopped. )

2 Likes

Jim,
That would be a great addition. Thank you. I hope you and Tom make quick progress.

Is there an PanX email app out there already? I can imagine that just retrieving the body text of an email would not be too complicated, but my mind stops when including sent/received attachments or embedded graphics.

A common stumbling block in getting a Panorama database online and available to the outside world, whether it’s for sharing, web publishing, or both, is getting a static IP address, or even a reachable URL

This is especially true if you go through your internet service provider who may want big bucks to set you up.

The fact is that most of us have a stable IP address as it is, but it can change. If you’re relying on reliable outside connections other options are desirable.

There are hosting and co-location services available, such as MacMiniVault where you can rent a Mini or have them house yours. They take care of a lot of the connections for you for $30 a month for upward and you can run your own copy of Panorama Server.

The least expensive means is to run it all from one of your own computers using a service like No-IP. I’ve used them for years in order to forward hits to my in-house servers. Basically, I have a No-IP app on my machine that talks to their servers periodically to report my current IP address. If it changes, their server knows right away. Using a URL that goes to their servers, causes hits to be forwarded to my current IP address. It’s simple and fast.

The best news is that you can get this service for free if you only need one URL and you’re okay with using one of the many they have to choose from. Unless you’re promoting a site for commercial purposes and the domain name is critical, the free names are fine. You might choose a name that is along the lines of MyPan.Zapto.org. You create the beginning, then attach it to one of theirs; in this case “zap.org”. It’s that easy.

For $2 per month, you get some minor but useful add-ons, like the ability to keep the name you’ve chosen without regular confirmations and it can be secure: SSL.

Because I had more needs, I went up the ladder to their top-tier account. That’s where I can have up to 100 URLs listed for $20 a month. I’ve used as many as 20 at once when I had client sites in various degrees of development and it allowed them to check in on how things were looking. It also allows me the option to use my own domain names and not one of theirs. In other words, it allows me to have a full-blown web site with one or more registered URLs.

Scroll down the page at No-IP for their full description. And be aware that they are not the only such service.

It will still be necessary to deal with port forwarding on your router, setting port 80 for HTML, 5900 for VNC, etc. With all the different router interfaces I’m going to touch it here. Your router should have help on this, but NO-IP does too, and theirs is quite useful.

With that set up, you’re ready to get started with the Panorama aspects.

my 2018 tesla model s p100 d charges up to 420 miles exactly.

well, it did before i totaled iit 3 weeks ago…

Those Plaids will do it to you

not a plaid, but the next one may well be. i thought about a lucid, as elon’s psychotic behavior casts a bit of a shadow over tesla, but as of know im leaning towards the devil i know…

plus, im marooned in ohio , so i probably have to find one here.

veering back on topic, ill let you know the mileage of the new one !

I’m glad you are ok.

First Steps to Web Publishing

Panorama’s Help file has excellent information on getting your server up and running. In particular, see Panorama Server and Using an External Web Server. The simplicity it adds to getting the Apache server software configured and running is impressive.

Once you’ve got it running and responding to that degree, it’s worth noting that any static HTML pages you create for your site go to the site’s root folder. The Apache panel of Panorama X Preferences will take you right to it.

Screen Shot 2023-08-22 at 3.10.04 PM

Separate from any Panorama generated pages, this becomes the place for html pages, graphics, templates and other parts of any built out web site.

The Panorama databases for your website are automatically placed inside ~/Library/Application Support/PanoramaX/Server/Public Databases. You have no need to deal with these directly other than to back up the folder for critical data.

There are many purposes for having Panorama driving a website or parts of it. For this particular example, I’m going to start with a page that requires users to log in before they can access other parts of the site.

I’ve built a fairly basic HTML page with two cells and a Submit button that I’ve renamed to Log In:

Screenshot 2023-08-22 at 2.58.02 PM

Here’s the HTML code, which can be created in any app that handles text:

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Log In</title>
</head>

<body>
<form action="/cgi-bin/panoramax.cgi?dbase~login" method="post" id="login" name="login">
  <table>
    <tr>
      <td> Email Address:</td>
      <td><input placeholder="Your Email Address" type="text" name="Email" size="20" maxlength="50" autocomplete="off" /></td>
    </tr>
    <tr>
      <td> Password:</td>
      <td><input placeholder="Your Password" type="password" name="Password" size="20" maxlength="25" autocomplete="off" /></td>
    </tr>
    <tr>
      <td></td>
      <td><input type="submit" name="submit" id="submit" value="Log In"></td>
    </tr>
  </table>
</form>
</body>
</html>

The default home page of any site is index.html. So for now, I’m going to name this page it to match the default and save it to my site’s root folder. As the site’s index page, it can be reached as MyURL.com.

Screen Shot 2023-08-22 at 3.23.00 PM

The form action of this page directs the browser to send it to MyURL.com plus /cgi-bin/panoramax.cgi?dbase~login. This tells Apache, via panoramax.cgi, to pass the hit on to Panorama. When Panorama gets it, it’s going to look for a web published database that I’ve named dbase. Within dbase, it’s going to look for a procedure named login. So I’d better make sure that I’ve fulfilled those expectations.

My database(s) can be named anything I want.

See Creating Shared Databases

Obviously I’ll want to do much more, but for now simply demonstrating a response from Panorama, my login procedure is simply:

Let lvEmail = “”
Let lvPassword = “”
WebFormItem “Email”,lvEmail
WebFormItem “Password”,lvPassword
cgiHTML = “You submitted “+lvEmail+” as your user name and “+lvPassword+” as your password”

cgiHTML is a variable created by Panorama and holds the contents of what is being returned to the browser. If my programmed response is plain text as it is here, Panorama builds an HTML page to hold it. ( I tend to build the entire HTML page myself and Panorama respects that )

So when I click on the Log In button to submit my entries of:

Screenshot 2023-08-22 at 2.58.50 PM

Panorama responds and my browser displays:

Screenshot 2023-08-22 at 3.46.26 PM

And now I’m ready to get busy building it out however I desire.

A more ambitious and realistic version for a log in stystem will search the online database for a matching email address and password. It will accept or reject the result of the search and respond accordingly. A link on the login form such as “I forgot my Password” is also useful.

Using more advanced techniques, the HTML page can include javascript and CSS to make it very full featured and polished. It can include checks before the form is submitted to be sure the cells have been filled and that the email address is properly formatted.

Screenshot 2023-08-22 at 4.03.10 PM

Of course, this login page as a gatekeeper is just one example of what can be done with Panorama on a website. Panorama can be used solely for generating pages of information that gets updated with some frequency. You can publish a personal directory of your contacts that you can access with your cell phone. Or you can build a catalogue of your company’s products that is fully responsive to customers’ searches. How about a questionnaire to gather and process information?

Hi Jim,
I am making progress. If you believe that we learn from our mistakes, then I must be a genius by now.

I have set up a url using Noip, evrange.hopto.org. I have my Mac Mini running the PanX server, and it is set to update its IP address with Noip so it will remain reachable at this url.

I turned on the Apache server, and edited the index.html file with the login form that you posted.

That’s as far as I have gotten. Anyone who enjoys filling out login forms can try it out.

I am continuing to work through the steps in your last post.

Tom

BTW, Jim, the Shared Database link above is taking me to the Under Construction Page. I can access Creating a Shared Database within the PanX help system.

Where do I put the response code? Where is the login procedure?

I’m building the rest for you and will provide the parts. Meantime I’ll continue to post notes of how I’m doing it here.

Based on your questions and what I get via the form, it appears that what you most lack at present is the Panorama database and its single ( at present ) procedure.

If you refer to my example, I created a database named dbase and shared it as a Web Published database. For now it consists of a single procedure named login.

Rather than Panorama, I should have written PanoramaX Server.

That worked. Thanks.

cgi URL Structure

We’re dealing with URL’s built for a cgi application. For Pan X Server, that amounts to the domain name followed by /cgi-bin/panoramax.cgi?

In a URL directed to PanX Server, everything following the ? is an element of an array using tildes as the separator. PanX Server picks the array apart in order to know what to do with it. The first element is the name of the database the hit is being directed to. In this case: dbase. The second element is the name of the targeted procedure. In this case: login.

The array can be extended quite a bit with more elements that you, the Panorama programmer, can use within your procedure and any others it calls.

The two web pages shown below do the exact same thing. Functionally they are equals.

They both serve as the front door to a site being run by Panorama X Server.

Once an Email Address and Password are submitted, PanX Server will scan the appropriate database for matches. The Email Address must have the right string, but case is irrelevant. The Password must be a precise match.

The Forgot Password link on the login page requires that an email address be included before submitting to the server. If that email address is matched in the database, an email is sent from the server with the password.

Failing to find a match in any of these scenarios, the programming will respond that no such account was found. If too many matches are found ( shouldn’t happen ) it will also reject the effort to log in.

A successful login will be matched ( in this case ) to a user level that will be used to include or exclude links and capabilities in subsequently generated pages; something akin to Read Only, Read and Write type privileges although many other degrees are possible. Similarly, a Date field can be used as an expiration date for access.

And from there, the possibilities for what the website can do in exchanging information is boundless.

The difference in the two web pages below is that one is pretty much bare bones HTML. The second has the benefit of CSS styling to give the page some visual appeal. Panorama doesn’t care which approach you take and works with either equally well.

Screenshot 2023-08-27 at 8.43.16 AM

BTW, I respect intellectual property rights. I am in contact with the illustrator regarding the right to use the image in a limited manner.

There is. See Mailbox in the Database Exchange. It can be used on your Desktop machine to send one or many emails from a Panorama database.

Mailbox uses a Python script and can differentiate between Python versions to correctly process the sending.

Currently there is an error in the Python script, exclusively when attachments are included, but merging data and embedding graphics is working properly.

Thank you, Jim.

After failing to get Python working to send an email, I tried using Panorama’s sendemail statement. While a database on the server machine can use sendemail without a, when the server tries to send an email I get an error:
Panorama X Server Error: Error: Not authorized to send Apple events to Mail.(-1743)
Does anyone know how I can fix this?
BTW, is it unclear what I mean when I say “the server tries to send an email”?