Original date:2021-02-09 15:06:53 Edited by: CraigWelch Subject: Re: Is Phix the new de facto standard for Eu programmers?

petelomax said...

Indeed. We are fighting a downhill battle, and somehow still losing. In my mind there is one, and only one, gigantic stumbling block: running Euphoria/Phix in a browser, with a reasonable gui and some kind of file/database support. I am completely and utterly lost regarding the latter, perhaps wrongly I suspect you might think that is perhaps the easiest part?

For quite a few years now, the only GUI I've used has been the browser. You can make it do anything you want. My setup is:

I design and build the webpage(s) using Webix. It provides full HTML / Javascript / Ajax functionality. On the server are a number of 'helper' Euphoria programs. For example, to populate a dropdown menu with all of the .EDB databases, the Ajax call is to DB_list.eui. This will just ls *.edb > DB_list.txt. DB_list.eui then reads DB_list.txt and sends it back as output.

-- This program lists the 'edb' databases, and outputs them for a richedit control selection 
system_exec("ls -t *.edb > edb.txt" , 0) 
sList = read_lines("edb.txt") 
sBuffer = "[  \n" 
for i = 1 to length(sList) do 
	if i = length(sList) then 
		sBuffer = sBuffer & "{ \"id\":" & sprintf("%d",i) & ", \"value\":\""   &  sList[i]   &  "\"} \n" 
		sBuffer = sBuffer & "{ \"id\":" & sprintf("%d",i) & ", \"value\":\""   &  sList[i]   &  "\"}, \n" 
	end if 
end for 
sBuffer = sBuffer & "]\n" 
puts(1,"Content-type: application/json\n\n\n") 
puts(1, sBuffer) 

The calling Javascript is, clearly, expecting a Javascript response. Partial code:

					{view:"fieldset", label:"Database Maintenance", height:80,css:"odd", 
					body:{ padding:2,//defining Fieldset body 
										{		cols:[ 
							                		{view:"richselect", id:"Database", options:"./find_database_names.eui", width:200, value:1}, 
				     								{view:"richselect", id:"Table", value:"Tables", options:"./greys_utilities.eui",width:200}, 
				     								{view:"template", id:"Entries_count", template:"entries",width:110, height:20}, 
				     								{view:"richselect", id:"Action", width:200, value:1, 
												             { "id":1, "value":"Create_DB"}, 
												             { "id":2, "value":"Compact_DB"}, 
												             { "id":3, "value":"Add_Table"}, 
												             { "id":4, "value":"Delete_Table"}, 
												             { "id":5, "value":"Merge_Tables"}, 
												       		 { "id":6, "value":"Shrink_Fields"} 

A given application will have several of these helpers, for reading databases, processing data, etc. They're usually quite small and easy to write.

As for databases, I use the Euphoria database exclusively. I have never had the problems that others seem to have had, perhaps because I use a functional locking system to avoid conflicts.

For debugging, I have a few terminal tabs open, with (for example) 'tail -f /var/log/apache2/access log' (or error.log). Error messages are printed to STDERR, so that they show up in the Apache logs.

The development environment includes a webpage that shows the latest ex.err, and of course the formatted version using Antonio Alessi's program. It also shows the latest Apache errors. See screenshots.

I ensure that all programs can be run from the command line as well as calling them by url, even though they will, with clean code, crash because of lack of input (which would be provided in the calling url). Whenever any code changes are made, the command line invocation will show any syntax errors, which are difficult to troubleshoot otherwise. If all is OK, run it from the browser, check the dump if there's a fatal error, and check (as above) the error logs in real time to show any trouble-shooting messages.

This might not suit everyone, but it works well for me. Happy to answer any questions about the workflow.

Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu