Feel free to ask about Aloe here and @Tim Dietrich and I will try to answer. Anyone else can answer too…
Robert asked this here: https://forum.xojo.com/43345-xojo-web-vs/last but I thought it’d be better to start another thread…
[quote=352186:@Robert Litchfield]@Hal Gumbert , @Tim Dietrich ,
I watched your demo at the VXUG September 2017 Meeting and while I’m understanding the overall concept I’m having trouble putting it into practice. From what I understand from your demo, Aloe should improve the performance of my existing slow application (possibly due to my own newbie mistakes). To help me understand the implementation of Aloe, would it be possible to see 1) how pages interact with each other and 2) how to retrieve data from a form.
My application consists of about four pages, of which two of them are input forms with pre-populated form fields. The application is too slow, and I’m trying to find ways to improve the performance. (I have another thread related to this.)
BTW…if this should move to another thread…I’m happy to do so.
Since we’re using standard html posted forms, you need to handle receiving the posted data and create a form to post the data.
Near the beginning of the loading a page, we check to see if any data was posted and for good measure, see if we have a value in the posted value called token. If we do, we run our method to save the data.
[code]// Data was posted
If AloeRequest.WebRequest.Method = “Post” Then
// Save the Data
If AloeRequest.POST.Lookup( TablePlural + “DetailForm” + “Token”, “” ).StringValue <> “” Then
// Save the Data
Then we create the html form populated with the data from the record. If data was posted, the record is already updated since we saved. Below you can the form opening tag that posts back to the same page. Then we include two hidden form fields. Further down in the code, are all the other form fields like First Name which would use the data from Records.Field( “NameCompany” ).StringValue.
[code] // Open the form.
HTMLDetail = HTMLDetail + “”
// Form Token
HTMLDetail = HTMLDetail + “”
HTMLDetail = HTMLDetail + “”[/code]
In Xanadu, I use the following code to add a floating div, show a ‘Name’ label, and then add an html table to display the labels / fields.
HTMLDetail = HTMLDetail + GetDivBeginStageFloat( “auto” )
HTMLDetail = HTMLDetail + “
HTMLDetail = HTMLDetail + GetTableBeginNoBorder
Field = New FormField( “Text”, “NameCompany”, Records.Field( “NameCompany” ).StringValue, "width: " + GetPX( GetWidthDefault ) + “;” )
HTMLDetail = HTMLDetail + GetTableRow2RL( “Company”, Field.HTML )
Field = New FormField( “Text”, “NameTitle”, Records.Field( “NameTitle” ).StringValue, "width: " + GetPX( GetWidthDefault ) + “;” )
HTMLDetail = HTMLDetail + GetTableRow2RL( “Title”, Field.HTML )
Field = New FormField( “Text”, “NamePrefix”, Records.Field( “NamePrefix” ).StringValue, "width: " + GetPX( GetWidthDefault ) + “;” )
HTMLDetail = HTMLDetail + GetTableRow2RL( “Prefix”, Field.HTML )
Field = New FormField( “Text”, “NameFirst”, Records.Field( “NameFirst” ).StringValue, "width: " + GetPX( GetWidthDefault ) + “;” )
HTMLDetail = HTMLDetail + GetTableRow2RL( “First”, Field.HTML )
Field = New FormField( “Text”, “NameMiddle”, Records.Field( “NameMiddle” ).StringValue, "width: " + GetPX( GetWidthDefault ) + “;” )
HTMLDetail = HTMLDetail + GetTableRow2RL( “Middle”, Field.HTML )
Field = New FormField( “Text”, “NameLast”, Records.Field( “NameLast” ).StringValue, "width: " + GetPX( GetWidthDefault ) + “;” )
HTMLDetail = HTMLDetail + GetTableRow2RL( “Last”, Field.HTML )
Field = New FormField( “Text”, “NameSuffix”, Records.Field( “NameSuffix” ).StringValue, "width: " + GetPX( GetWidthDefault ) + “;” )
HTMLDetail = HTMLDetail + GetTableRow2RL( “Suffix”, Field.HTML )
// Column End
HTMLDetail = HTMLDetail + GetTableEnd
HTMLDetail = HTMLDetail + GetBR + GetDivEnd[/code]
It looks like this in the interface, in the Name portion…
This looks very interesting…let me work through it this afternoon and if I have questions I’ll post them here.
Well that worked like a charm! Once I got my head around it, it all makes sense as it is somewhat like building the old .asp web applications with VB.
I do have a question though, why do you have a mandatory default value on the POST.LookUp()? The reason I ask is that I might be missing something in the way I did it.
The more I play with this…the more I like it. I was concerned I might need to move to Rails in order to get the scalability I wanted, but now I can stay in the Xojo system (which I’m a fan of) while getting the performance I need.
If AloeRequest.POST.Lookup( TablePlural + "DetailForm" + "Token", "" ).StringValue <> "" Then
Tim has Aloe returning the post values in a dictionary. So that is looking up the value for the key TablePlural + “DetailForm” + “Token”. I calc the key so I don’t have to go to each page and copy paste the Token name for that page. TablePlural is just the plural form of the table, in this case ‘Contacts’. The second parm in the Lookup is “” which means return “” if that key does not exist in the dictionary. I could use the same token name on every page, but I wanted it to be specific…
I’m psyched you like it. @Tim Dietrich did a spectacular job making Aloe super fast AND simple for the rest of us to take advantage of! Aloe really makes Xanadu shine!
I’ve been mucking around in it for the last couple of hours testing different use cases. So far Aloe is passing most of them, though more testing is still needed.
I am missing the ability to access a session variable though (maintain state per site users). I know @Tim Dietrich is working on adding a session module, so I’m looking forward to testing that when it is available.
I will do more testing over the weekend because I want to see Aloe in action pulling a fair amount of data from a DB and displaying it. That will be the true test of the performance for my use cases.
Just received my Amazon AWS Invoice for:
- $5/month Amazon Lightsail
- ~$30/month Amazon Aurora MySQL
And that can run multiple apps, depending on the load…
I have a vps that runs about $24 per month that I run email, web, mysql, and a few small apps on. It’s not as loaded as I thought it would be so I could probably run it for less than $20. There’s a ton of low cost options out there.
I keep being impressed by the numbers you’re going with. My websites are still running on a fairly slow virtual web server, with an Apache (or is it Nginx? I can’t even tell) html + php server, and I pay about $10/mo for it. Never ran out of capacity or it getting slow. The only kind of high load I needed was for delivering my apps, which. thanks to Xojo, are about 10MB in size, and would drain on the traffic limit in the past. So I am using Amazon S3 for downloading those files now, and I pay about 1-2 US$ a month for that.
What kind of stuff do you guys run that require you to pay $35 a month??
I could have paid about $10 and gone with dual core instead of quad core, but we host about 75 email accounts and webmail service on that vps and I wanted it to be snappy. No complaints so far.
I host my personal stuff at home and don’t pay anything for it beyond my regular internet connection. Been that way for many years now. Used to host it on an old powerbook g3 with a dying battery. It would still last an hour on battery though, so better than a cheap UPS.
If I were to set anything up new, I’d probably find a used i7 mac mini or a maybe a nuc and load proxmox on it and host everything myself. It’s nice to be able to spin up a vm quickly and the backup in proxmox is very easy to use. You can rsync the backups to a local machine and be able to get back up and running quickly. We have a couple of machines at work set up this way. It’s quite nice. You can spin up a new vm, or a backup of your current one and test out changes and then blow it away when you’re done.
Kevin, running a server from home - that requires you to have a static IP, or use a dyndns service, though. The latter I find a bit unreliable, don’t you?
most of that is DBaaS (MySQL as a Service) costs… LightSail and Digital Oceans smallest servers are $5/month.
I have my domains with NameCheap. They have an included dynamic dns service that I have setup on my router (mikrotik). It updates as needed. Most providers in my experience, at least in our area use DHCP and unless there is a prolonged power outage on the provider’s end, the ip that is assigned from the server remains the same. I think it’s been a couple of years or more since our IP has changed.
Added some info on the Xanadu web page how @Tim Dietrich and I are deploying our Aloe based Xojo Web Apps on Amazon Lightsail using NGINX, Amazon Aurora, and Amazon S3.
Tim will be demoing “Hosting Xojo Web apps w/ Amazon Web Services, Nginx, and more.” at the next VXUG meeting.
Aloe is a great project. Thank you so much! Running in the debugger works awesome.
I am having an issue though. After building it as standalone, I copy the htdocs, logs and data folder into the same level as the app. When I load the page in the browser, I get the 404 page.
Demo 1 gets the 404 page
Demo 6 gets a blank page in the browser
I tried building a standalone for OSX and for the raspberry pi. Both get the same result.
@Scott Siegrist : Try moving your compiled app into a subfolder, so that the folder structure looks something like this:
/app your-app your-app Libs your-app Resources /htdocs /logs
Thank you, @Tim Dietrich . Moving the app into a subfolder did the trick.
The structure Tim suggested makes it easy to replace the app without having to move the supporting folders.
I am trying the equivalent to adding an edit button to demo6
when submitting the button I get post variables for all records opposed to the record selected.
here is one of my current attempts
[code] + “” + “<form action=” _
- “”"""" _
- “id=form” +str(Rank) + “>” _
- “<input type=” _
- “”“submit”"" _
- “name=” _
- “value=” _
- “Submit” + str(Rank) + “” _
- “<input type=” _
- “”“hidden”"" _
- “name=” _
- “”“shop”"" _
- “value=” _
- Records.Field(“Domain”).StringValue _
- “” _
- “” + EndOfLine _
@Tim Kearns: It looks like your closing form tag is incorrect.
Here’s an example of a button that works with Demo 6:
[code] TableHTML = TableHTML _
- “” _
- “<form method=”“POST”" action=""/shop"">" _
- “<input type=”“Submit”" name="“submit”" value="“Shop”">" _
- “<input type=”“hidden”" name="“drummer”" value=""" + Records.Field(“Drummer_Name”).StringValue + “”">" _
- “” _
- “” + EndOfLine[/code]
I hope that helps.