I have a web app that is all run via one perl file that works with a database. At one point the user can execute an action that takes a lot of time (it adds a bunch of rows from one table to another). Is there a way I can have a wait .gif or message show while the sql is executing, and then have it disappear once it's over? I'm pretty new to perl, saw that this was possible through Javascript and the PleaseWaitButton though. Any help would be much appreciate though. My code for the lengthy update part is below, so I image whatever thing would need to be inserted somewhere in there:
if((#inTable[0])==0){
my $update = `perl /stockhistory.pl
my #updatearray = split(" ", $update);
my $val;
for(my $i = 0; $i < scalar #updatearray; $i+=6){
$val = eval{ExecSQL($dbuser, $dbpasswd, "insert into PORT_ModernData (SYMBOL, TIME, OPEN, HIGH, LOW, CLOSE, VOLUME) VALUES (?,?,?,?,?,?,?)",undef, $stocksy,, $updatearray[$i], $updatearray[$i+1], $updatearray[$i+2], $updatearray[$i+3], $updatearray[$i+4], $updatearray[$i+5]);};
}
}
Thanks for any and all help!
The way I understand your problem, I would suggest Javascript, though I do like avoiding it myself.
This way, the user can click the button, triggering the sql get, and the message comes up, while the server does what it does, when done, Javascript can tell the user so and provide the link, data or whatever the result is.
With perl, this would involve a more complicated procedure including further server/client communication.
I would gladly be corrected, though, if anyone knows better.
Related
If it's okay, I'm kind of in need of assistance,
This is an AR filter mini game.
I would like to replace an object's material when the loop count reaches a certain value. I found it extremely challenging to do it with the Patch Editor so I went and explore options with scripting but I really hit a wall with Reactive Javascript. (I'm only an amateur with the conventional javascript and have no idea how to use If-Else statements in Reactive JS).
So I was wondering if there's a way to change an object's material dynamically, controlled by a loop counter? Any help would be greatly appreciated.
Let me know if there are any additional screenshots you need (Or project file, for the matter).
The object does not have a material attached to it.
(The software uses reactive javascript)
*I also shared a similar post in the Facebook group dedicated to Spark AR but I don't seem to get any responses so I figured I'll try my luck here.
Someone from the Facebook group responded and told me that a loop is sequential and a callback is reactive and provided the callback function sample code and I slotted my conditional statement in and it worked! Just thought I'll post this answer here.
const Time = require('Time');
const interval = Time.setInterval(function changeMat(){
if (loopCountNum.pinLastValue() >= 0 && loopCountNum.pinLastValue() <=10)
{
car.material = carMaterial;
}
else if (loopCountNum.pinLastValue() >= 11)
{
car.material = carMaterial2;
}
}, 500);
Request
GET /drive/root/children?select=name,size,parentReference
returns, for parentReference, for example,
"parentReference:{
"driveId":"3e2dd398785a81d",
"id":"3E2DD398785A81D!103",
"path":"/drive/root:"
}
Is there way that parentReference in reponse contains only id:
"parentReference:{
"id":"3E2DD398785A81D!103",
}
Ideally you should be able to ?select=name,size,parentReference/id but that currently doesn't work (it'll behave like ?select=name,size,parentReference). We aim to fix that at some point though, and so you're more than welcome to use the former syntax and it should start working when we fix it. Until then you'll just get back some extra things you don't actually care about.
ok so im sorry to be asking, however im trying to make it so that when i press z, a portal appears at my Spr_players coordinates, however if one of them already exists, i want it to be erased and im simply wondering what ive done wrong. Again sorry for bothering. (please note that i am a bad programmer and i appoligize if i broke any rules)
if object_exists(portal)
{
instance_destroy()
action_create_object(portal,Spr_player.x,Spr_player.y)
}
else
{
action_create_object(portal,Spr_player.x,Spr_player.y)
}
The instance_destroy() statement destroys the current self instance which is what is executing the code. You must use the with (<objectID>) {instance_destroy()} syntax to destroy another instance.
As long as there is only one instance of portal in the room this code should work:
if object_exists(portal)
{
with (portal) instance_destroy(); //you should also need a semicolon here to separate
//this statement from the next, it is good practice
//to do this after all statements as I have done.
action_create_object(portal,Spr_player.x,Spr_player.y);
}
else
{
action_create_object(portal,Spr_player.x,Spr_player.y);
}
If there are multiple instances of portal this will only destroy the first one. To destroy all you would have to use a for loop to iterate through them all. Off the top of my mind I can not remember the function to get the ids of all the instances of an object, but it looks like this is not a problem since each time one is created the existing one is destroyed and thus you will only have one a t a time.
Another way of doing this is just to move the existing portal to the new position. The only difference here is that the create event of the portal will not be executed and any alarms will not be reset.
portal.x=Spr_player.x
portal.y=Spr_player.y
Again this will only move the first portal if there are more than one.
I am new here. I am very happy that I joined this website, because everyone here is so smart!
Now, let's cut to the chase! Hopefully, I will be able to explain everything properly.
I am creating a Visual Basic application. It's supposed to reassemble a so-called "fake programming language." It's having some issues though.
Let me show you an example before explaining:
If RichTextBox1.Text.Contains("console output >'insert comment';") then
Console.WriteLine("insert comment")
End If
Now, what I want here is a custom input. (if someone types "I want cookies" then I want the console to say that!
For instance, if I type:
If RichTextBox1.Text.Contains("console output >'Insert something here';") then
Console.WriteLine("Whatever the user wrote!")
End If
I just want to possibility to write whatever I want, that's all! I hope I made myself clear, because I am having a hard time explaining here. Help is appreciated! Thank you!
You need to match just the part with the console output > and then replace that portion of the string with empty space, like this:
If RichTextBox1.Text.Contains("console output >") Then
Console.WriteLine(Replace(RichTextBox1.Text, "console output >", ""));
End If
I have a php script (ini.php), that open in an iframe inside of "main.php":
<iframe src='ini.php' style='width:650px;' frameborder='0' id="IDMain" allowtransparency="YES" scrolling="NO"></iframe>
The SQL does not retrieve the data in "ini.php".
But if I incorporate the code of "ini.php" in "main.php", without using an iframe, the query retrieves all the information.
I must have an iframe in order to change all the different scripts in the same iframe.
Any help here?
Thanks
In addition more information:
The main.php is in session after logged. Previously I had the whole frame repeated in each script, and everything was ok.main.php, ini.php, and so on. Each script with header, left, right, main and footer. To make it faster and easier I decide to make the main script called main.php, that with an included script called config.inc.php that has several functions, also connects to data base, to retrieve some data to the header, left , right and footer sides of the main area (iframe) where the others different scripts, just to opens inside of a iframe, maintaining the information around. Each script, (like ini.php), that runs in the iframe also include the config.inc.php file, to connect as well to database. But does not retrieve any information
The connection to database in config script is:
<$connect=mysql_connect ("localhost","database","password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("database", $connect) or die ("'I cannot connect to the database "); >
The query in ini,php (and others) is:
`
if ($id) {
$id_session=$_SESSION['id_session'];
$namesession=$_SESSION['name_session'];
$sql="select * from data where id='$id_sessino' limit 1 ";
$result=mysql_db_query("database",$sql);
$regist=mysql_fetch_array($result);
$id=$regist["id"];
$id_session=$regist["id"];
$namesession=$regist["name_session"];
$country=$regist["country"];
And soo on…
}
`
I hope with is information it makes it clear what do I mean. Thank you
Check PHP help for mysql_db_query. Since you are not giving it any open db link, it tries to do some default magic, which likely fails, because, as I mentioned in the comment, the two scripts (in parent window and inside the iframe) are run separately and have no idea about each other *unless you are doing some synchronizing, that isn't shown in the code snippets. That means that the iframe script doesn't know anything about the connection you've opened in the parent page, and fails. Check your logs, you should see some E_WARNING complaints (if you are logging this level).
Also, as the documentation says, you might be better off with MySQLi or PDO_MySQL extensions. But the principle will remain the same - the script in questoin has to have an open connection to the database (and I'm not sure whether you can easily and safely transfer an open from one script to the other one, so you'll likely have to do it all in the iframe script).
Try two things, first I would change the MySQL_fetch_array part to
While($regist = mysql_fetch_array($result))
{
//Code goes here
}
Secondly try referring to the array vales as numbers rather than names, so regist['id'] would become regist[0]. They will be in the order the are in the database.
Also since you select your database when creating connection why not just use mysql_query("QUERY HERE"); Rather than mysql_db_query