Welcome, Guest
Username: Password: Secret Key Remember me

TOPIC: Web Interfaces for, well, EVERYTHING!

Web Interfaces for, well, EVERYTHING! 2 years 11 months ago #17834

  • hop
  • hop's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 526
  • Thanks received: 46
More on the database query PHP coding...

When someone does something like this, it is important that you touch on ALL the languages you are writing and supporting DAILY! Too much javascripting will lead to issues writing PHP because of the syntax differences and vise versa. Something I have learned on this project big time!

I felt it worth mentioning that to make testing my new PHP query builder fast and easy, I simply copied the working current version so I could make changes to it and then include them later into the working version. Yes, NetBeans has great version control for this, but once I get something working, I package it and create a new set of files to go after the next major change. It creates a lot of file clutter so good note-taking is key here. I use Excel and OneNote to support me with this.

So now all I had to do was alter the PHP file slightly to just log the built query into a log file, create my different scenario calls in the main page, then look at the log for issues. It's quick and mostly painless! :) and it does not alter my database in any way at all. No reason to have coding errors inadvertently alter my database data. To make sure though, I make frequent database backups using a cron job controlled bash script. All that can be removed later.
Last Edit: 2 years 11 months ago by hop. Reason: additional info

Web Interfaces for, well, EVERYTHING! 2 years 11 months ago #17835

  • hop
  • hop's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 526
  • Thanks received: 46
FOCUS! :woohoo:

It is worth mentioning that when you work on a project as large as what I am doing, that you keep your focus! I have been a part of DIY for a long time, and anyone here will tell you that I have big ideas, do the work, but get distracted and end up doing lateral research and projects, and never finishing anything.

I am OK with that because I learn a lot and it is just bringing each project to a certain level and ready to finish later. But this project has taught me one thing. Have a minor goal and finish it. And DOCUMENT EVERYTHING! Research, downloaded files, whatever.

And most importantly... have a big goal that encompasses the idea, but do not over-plan the eventualities. Planning for every eventuality certainly cuts down on failures, but you get bogged down into envisioning every scenario, and you lose site of the main goal. If you plan and code for the immediate need and document properly, you can add features later, revising a working version that is going to work for you already. It's part of the growing process.

Why do I bring this up? I just side-tracked on how cool it would be to put my database query builder results on a web page instead of viewing the log file each time. Yeah, cool, but unless I write it as a library tool, what is the point? Stay on the given path and make a note to accomplish that later, as a smaller goal.
Last Edit: 2 years 11 months ago by hop. Reason: Grammar

Web Interfaces for, well, EVERYTHING! 2 years 11 months ago #17836

  • hop
  • hop's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 526
  • Thanks received: 46
WOW am I having serious issues with asynchronous javascripting! It's like the code wants to flow to the end, but tasks spawned along the way that haven't completed yet are causing problems with the flow.

I figured out how to wait for the code to catch up, but I haven't figured out how to wait for the code to reveal results, before continuing. That's my next major hurdle.

I can delay things in order for the browser to catch up, but the delay that is adequate for my system may not be adequate for ALL systems. And what if a process on my system slows things down and the delay turns out not to be long enough? It's a very inadequate bandaid fix.

So the plan now is to use a timeout, but to loop recursively until an object is available. This will keep the browser from freezing while code catches up, but wait to process on dynamically created objects until they are available.

And that is where I am now. More when I code it!
Last Edit: 2 years 11 months ago by hop. Reason: Grammar

Web Interfaces for, well, EVERYTHING! 2 years 11 months ago #17837

  • hop
  • hop's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 526
  • Thanks received: 46
I have been doing some research and found that my idea was already in production elsewhere. I'm not going to succumb to using a pre-made library though, I will write it myself.

The idea is pretty simple... create an object in javascript that deals with a specific record from MYSQL. The object will have event handling that updates the database, etc, based on changes to the record. All the other related panel objects affected by the record will play a role. It's pretty simple really, and with a little coding, should be configurable using a json or database configuration package.

This might supersede other event handlers I have written. It's an object behind the scenes that automatically involves the MySQL database. It is beautiful really, and I hope it works.

More when I code it.

Web Interfaces for, well, EVERYTHING! 2 years 11 months ago #17838

  • hop
  • hop's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 526
  • Thanks received: 46
Well, I'm going sideways a bit and checking out node.js. There is a lot of support for it, even in my current NetBeans 8.1 IDE. A lot of my asynchronous issues might be solved with using Node.js so it is worth a look. Because this might be a viable solution for me and my server is on my lan, I will use the proxypass solution for piping to an alternative setup. I will not drive too deep into this rabbit hole just yet, but some simple tests using MySQL to support a web-based app might prove to be a faster, more javascript-based solution. I'm excited!

And since node.js can be served easily on a beagle bone black, I might be able to have a non-pc based server that handles all this for me.

More when I discover and code it.

Web Interfaces for, well, EVERYTHING! 2 years 10 months ago #17843

  • hop
  • hop's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 526
  • Thanks received: 46
I have been hitting a brick wall with asynchronous coding in Javascript for a couple of weeks now. I solved it, but every time I create an object or control, I have to do callbacks to wait for when the object finally updates in the DOM. This posed a challenge for me when I created a database object that was not associated with a dom object. I think I have that solved too.

Everything needs to be setup using a database so it is completely configured by that database support, so I have to code around that if I EVER hope to allow this to be designed using an IDE. If I have to hard code a structure, that goes against the purpose of this adventure.

I'm so close to completing this. Once I figure out how to wait for objects to be available to add to them the things I need, like events, etc. then I will have this solved.

Almost done. The last hill to climb is a big one!

That's my update. Almost there.... >GRIND GRIND GRIND!!<
Time to create page: 0.264 seconds