w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Powershell start-process script calls a second script - how to make one script only
Windows does not allow a process to elevate while running. There are some tricks but in one way or another they will spawn a new process with the elevated rights. See here for more info. So the easiest way for PowerShell is still using one script to Start-Process the other script elevated.

Categories : Powershell

How run a progress bar to indicate the other process is busy in Qt
The QProgressDialog will only close when the value passed to setValue reaches the value set by setMaximum. You have set both the minimum and maximum to be 0 so obviously the dialog will not function properly.

Categories : C++

how to make a php/ajax script to show text depending on function of php script
Add a div to your 'myDiv' call it with an id 'message' and change it with javascript accordingly when calling the functions? $('#ajaxMessage').html('My message'); Hopefully this answers your question.

Categories : PHP

Progress Bar for AJAX based on server-side process
For those wondering how I ended up doing this, I ended up doing several AJAX requests. My first AJAX request determined how many requests were going to need to be made (I had 700,000 DB records, I did 30,000 at a time) and setup the loading bar. Once the loading bar was setup, I hit the same ASPX file "X" amount of times, for each call that's made, I update the progress bar (Requires a bit of math). Once the progress bar reaches 100 percent, I do another AJAX request to grab the result from the server side processing that I did. My initial code that calls comparison.aspx, and appends it to a div. $.ajax({ url: "comparisons.aspx", type: "GET", success: getComparison, error: showErrors }); //On Success, show results function getComparison(result) {

Categories : C#

need python script to use already open Xvfb server process
I have resolved this issue by removing these lines from my python code: #set pyvirtual display display = Display(visible=0, size=(800, 600)) display.start() and adding the following lines: import os os.environ['DISPLAY'] = ':1' This way the python script uses the already open Xvfb process setup on display 1 instead of starting a new Xvfb server process.

Categories : Python

How to make progress bar with jQuery and PHP while waiting server process?
check Jquery Progress bar UI : http://jqueryui.com/progressbar/ use .getJSON or an ajax call every 10 seconds to call the server and check the progress after you get the server progress update the UI Explaining Step2 step 2 is generally based on your application flow, lets say for example i'm inserting 100,000 records in MYSQL, i would create another service that will check the rows count and the result were 30,000 records for example, that means the progress now is 30%, so if i call this service every 10 seconds i would get the current progress.

Categories : PHP

Best process to handle AJAX file processing on server which takes a long time
It's a serverside timeout you're experiencing, not clientside. You haven't implemented an error handler in your Ajax call, so it doesn't see that Apache (and its ilk) terminate a request automatically after 30 or 60 seconds (configurable in apache2.conf). Upping the maximum request time is an option, but a bad one since it will clog server resources. It's better to handle this asynchronously. When the file is successfully uploaded return a success code to the Ajax call. This also allows you to provide useful feedback to the end user saying he can now go grab some coffee and wait for processing. Spawn a background job, or have a cron pick up the file in the queue, and start processing it. Use a long poll mechanism (or websockets if you're on a roll) to open a longstanding relationship to

Categories : PHP

Make a Ajax POST query to php script
if the data is in a form you can serialize the form var data = $('form').serialize(); see http://docs.jquery.com/Ajax/serialize

Categories : PHP

Start ajax server script and poll for completeness
Firstly if you do not want your Ajax Request to timeout, you can use the 'timeout' attribute. XMLHttpRequest object used for Ajax calls has a 'timeout' attribute. Check out the documentation at http://www.w3.org/TR/XMLHttpRequest/#the-timeout-attribute .If you are making the Ajax call using jquery, you can simply do something like $.ajax({ url: 'your url', timeout: 100000 //this sets the timeout as 100 sec ……//your other attributes for the call }); If you are interested in tracking your request progress, that might be a little difficult unless you want to track the completeness(complete), error, success or a particular status code. jquery provides different(complete, error, success and status code) properties for this. If you write a native ajax call(without query), the onrea

Categories : Javascript

How to respond to client when the server is busy processing a long transaction
Your scenario screams for the asynchronous communication. That is, you should rewrite your application to have three different methods: first one receives a request, generates unique ID which is immediately returned to the client and invokes EJB to generate the report; its signature would be something like: public String generateReportRequest(Object requestParameter) { .. } second one receives a unique ID and checks with EJB whether the report generation is done; its signature would be: public boolean isReportGenerated(String uniqueID) { .. } third one actually returns the report, but it should be invoked only when the second one returned that the report is ready: public Object returnReport(String uniqueID) { .. } Since we are dealing with three methods, I would not recommend mixing

Categories : Java

Unable to make a file auto-download from an FTP server when script is run
There are two (or maybe more) ways you can do this. You could store a copy of the file on your server like you do with ftp_get and send it to the user afterwards. Or you could download it every time. Now you can do this using ftp commands, but there is a quicker way using readfile. Following the first example from the readfile documentation: // Save the file as a url $file = "ftp://{$ftp_user_name}:{$ftp_user_pass}@{$ftp_server}" . $_GET['file']; // Set the appropriate headers for a file transfer header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . basename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma:

Categories : PHP

Jquery Post/AJAX - Does closing window with code affect server script?
Once the server receives the AJAX Request along with the data, it would process it as usual, even if you close the page or the window. If you close the browser window before the server receives the AJAX Request, the processing it not going to happen. Furthermore, if the AJAX Request is returning any kind of data or displaying messages, it is advised that you leave the window open, so that there is some "Listening" page to the Server's Request Response.

Categories : PHP

PHP ajax process 404 page not found error before complete the process
You can rise the time that a script is allowed to execute: http://php.net/manual/de/function.set-time-limit.php Give attention to your max_execution_time in php.ini But i wouldnt suggest if you are doing this in the frontend then it sounds more like an performance problem of your script. No user want to wait more than 4 seconds for website. Also 2 seconds are too long.

Categories : PHP

how to get process id(pid) from forked child process in shell script
From the Bash manual: ! Expands to the process ID of the most recently executed background (asynchronous) command. i.e., use $!.

Categories : Linux

Script to check if it is a directory or file and then process the rest of the script
Your usage of else if is incorrect, it should be elif if [ -f "$i" ]; then echo "this is a file and I'll run a script if it is a file" elif [ -d "$i" ]; then echo "this is a dir and I'll run a script if it is a directory" fi

Categories : Bash

PostgreSQL Performance: keep seldomly used small database in memory while server busy with big database
PostgreSQL doesn't offer a way to pin tables in memory, though the community would certainly welcome people willing to work on well thought out, tested and benchmarked proposals for allowing this from people who're willing to back those proposals with real code. The best option you have with PostgreSQL at this time is to run a separate PostgreSQL instance for the response-time-critical database. Give this DB a big enough shared_buffers that the whole DB will reside in shared_buffers. Do NOT create a tablespace on a ramdisk or other non-durable storage and put the data that needs to be infrequently but rapidly accessed there. All tablespaces must be accessible or the whole system will stop; if you lose a tablespace, you effectively lose the whole database cluster.

Categories : Postgresql

ajax show loading image when ajax is in process
function getProdList(id,langid) { var xmlHttp=initXMLHTTPRequest(); //console.log(xmlHttp); var str = "value="+id+"&langid="+langid; var span=""; var url = "../php/searchDetails.php?"; document.getElementById('imgDiv').style.display = 'block'; xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4 ) { document.getElementById('imgDiv').style.display = 'none'; span=span+"<ul style='padding-bottom:20px;'><li><b>"+id+"</b></li>"; var xmldata=xmlHttp.responseXML; var xmlObj = xmldata.getElementsByTagName("ProductDetails")[0]; var menusize=xmlObj.childNodes[0].childNodes[0].childNodes[0].nodeValue; var xmlObjlength = xmlObj.childNodes.length; for(var i=1;i<xmlObjlength;i++) { var ProductName=xmlO

Categories : PHP

Run PBS script and post-process output within bash script
I don't believe PBSPro supports this, but TORQUE (another PBS derivative) has a -x option that you might be interested in. You can submit a job like this: qsub -I -x <executable> This would run your job interactively and run the executable, with all of the output directed to your terminal, and the job will execute as soon as that executable terminates. You could then begin post-processing at that point. PBSPro may have similar functionality, but what I've described here is for TORQUE.

Categories : Bash

run a process from script and kill it from another script using PID
I would suggest using the first method you talked about. Creating a temp .pid file with the information on the process is a very common way to track the PID of a running process. It is easy to do in most languages and pretty straightforward. The second could create an issue because depending on what shell you use, that environment variable may be difficult to ensure that it is global and not touched.

Categories : Bash

Wordpress blog hitting several CPU process on hostgator server than the limit, causing 500 server error
Your problem is most likely related to the underpowered or over-provisioned HostGator shared servers. Since their purchase by EIG last year, they've migrated customers to new hardware, and from my experience (I host 40+ WP blogs with them) this new hardware or provisioning rules has created poor performance for any site that relies on MySQL such as WordPress. Shared hosting is always a gamble as you rely on the hosting provider to manage the number of accounts, and the performance as a whole. I've hosted with HG for years and they've been great, but since late 2013 the performance has been atrocious. Caching is only a band-aid, as the core problem is MySQL performance and the over-crowding of the server. Find another (non EIG) shared web host, or upgrade to a VPS to give you more cont

Categories : Wordpress

Preventing layout break using jQuery when entering "" via Ajax
It's simple. Do not use jQuery's .html(), use .text(). Escaping will occur automatically, there is nothing special you need to do apart from not using the wrong API function. <div id="textDisplay"></div> <input type="text" id="enteredText"> <button id="transferText">Click!</button> and $(function() { $("#transferText").click(function () { var userInput = $("#enteredText").val(); $("#textDisplay").text(userInput); }); });

Categories : Javascript

Ajax PHP script is not working - contact box with php ajax
Working DEMO Since you are using ajax , do it without refreshing the page Here is the edited code HTML <form method="post" id="kontakt"> <h3 class="title">Nur nicht sch&uuml;chtern !</h3> <input type="text" name="von" placeholder="Name" id="von"> <input type="text" name="mail" placeholder="E-mail" id="mail"> <textarea name="message" placeholder="Nachricht" id="nachricht"></textarea> <input id="submit" type="button" value="senden"> </submit> </form> <div id="response"></div> corrected the mistakes in your code, and it would be better to use $('#kontakt').serialize(),it will take the data automatically code $(document).ready(function () { $("#submit").click(function () {

Categories : PHP

Why does PHP response to AJAX contains ?
Any characters outside <?php ?> tags are sent back in the response. That's how you get that <script> tag in the first place when you access index.php from the browser. echo and print are obviously going to also send data. So I guess you should have that if($success) at the begining of index.php and exit; inside it, after print. Characters outside <?php ?> tags are sent as part of the response for historical and practical reasons. In our days having PHP code mixed with HTML is a bad practice (as some people already pointed out in the comments bellow). You either use a templating engine (most people know about Smarty) or use PHP itself as a templating engine. But "back in the day" PHP started out as just a simple templating engine (no classes, external modules, namespac

Categories : PHP

Process URL in CGI script
If you are processing data from a form in a Perl script, use CGI.pm and CGI::Expand to handle advanced query parameters. #!/usr/bin/perl use warnings; use strict; use CGI; use CGI::Expand; my $q = CGI->new; my $p = CGI::Expand->expand_cgi($q); $p will then contain all of your query parameters.

Categories : Perl

Checking username on local server using jquery, ajax and php ajax() not connecting
I always like to use GET request on AJAX issues, meaning to do jQuery AJAX with type:"GET" and read the parameter with GET on PHP.. So I can easily test the PHP page itself by running it in the browser like this localhost/ajax_check_username.php?username=something

Categories : PHP

using ajax to process a form
Heres some changes, read code comments, though the main thing wrong with your code is ajax will get the whole page not just echo "<font color='lime'>Updated.</font>"; part. <?php session_start(); include_once("./src/connect.php"); include_once("./src/functions.php"); //Update email only if request is from ajax request if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest'){ //check its POST, and email is real, then do update or exit a error message back if($_SERVER['REQUEST_METHOD']=='POST' && !empty($_POST['email']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)){ header('Content-Type: text/html'); //check its an email if(!filter_var($_POST['email'],

Categories : PHP

Run R script with start.process in .net
this is how it works for me: Dim myprocess As New Process myprocess.StartInfo = New ProcessStartInfo("C:Program Files (x86)RR-2.6.2inR.exe", "CMD BATCH C:/Users/test/test3.R C:/Users/test/testout.csv") myprocess.Start() second approach (first app. doesnt give me a good csv output so here this is a workaround): Dim proc = New Process proc.StartInfo.FileName = "C:Program Files (x86)RR-2.6.2inRscript.exe" proc.StartInfo.WorkingDirectory = "C:Program Files (x86)RR-2.6.2in" proc.StartInfo.Arguments = "C:/Users/Desktop/RtoVB/test4.r" proc.StartInfo.UseShellExecute = True proc.StartInfo.RedirectStandardOutput = False proc.Start()

Categories : Dotnet

Ajax with PHP - Is Ajax a replacement of server side "View" of MVC?
You've asked two questions but I'm just going to answer the first one: can AJAX replace the role a server-side view traditionally had? In MVC web frameworks the view is a template for converting data passed in from the controller into HTML, however, client-side templating languages have become quite popular and are a perfectly reasonable alternative to rendering HTML output on the server, and they have definite advantages. Firstly, since you're not sending an entire HTML payload to the client browser but instead just the content, you can save significantly on bandwidth. Generating the HTML client side allows you to transmit only data (like JSON or XML) to the client. The server side view would simply contain script tags pointing to the JavaScript templates and the content payload. Secon

Categories : PHP

Exclude some elements from ajax process
for example you can call a js function with command button and capture all the elements that you wanna send. ex: <script type="text/javascript"> <!-- function call(a, b, c, d...) { addDocument(a); ..... } --> </script> <a4j:jsFunction name="addDocument" action="addDocument" reRender="panellImatge" ajaxSingle="true"> <a4j:actionparam name="idDocument" assignTo="#{crearUsuarisBB.newDocumentId}" /> </a4j:jsFunction> and in command button call --Call(); I hope it helps.

Categories : Ajax

Email Reply To PHP script process
Thanks to Dragon for pointing me in the right direction. Add this to your /etc/aliases file (if you have postfix installed) process | "/path/to/php/script.php" Then run newaliases Then run /etc/init.d/postfix reload The PHP script looks like this $data = file_get_contents("php://stdin"); $data = mysql_real_escape_string($data); mysql_query("INSERT INTO test SET thing = '$data'");

Categories : PHP

Continuous status updates from a process using AJAX and PHP
I'll tell you what I did once, I'm no sure it's the best solutions but it worked. You should have an iFrame and set the target of the form to the iFrame <script> function showMsg(msg){ alert(msg); } </script> <form action="theCommandHandler.php" method="post" target="myIframe"> <input type="submit" value="Do A Command" /> </form> <iframe name="myIframe"></iframe> once posted to theCommandHandler.php, you should have a line of code like this in your php script: echo "<script>parent.showMsg('$idx/$count: File $f has been copied successfully to $tar_dir - $s');</script>"; You can send as many messages as you like back to client and they will invoke the showMsg function on the parent document.

Categories : PHP

How to force subtree process on ajax request
I found a solution, maybe not the best in performance. I extended PartialViewContextFactory, wrapping the original PartialViewContextFactory. The new class (shown below) does the following things: 1) It creates a new CustomPartialViewContextImpl passing it the original PartialViewContext. 2) It overridesCustomPartialViewContextImpl.getExecuteIds(), in order to find all the ancestors. A note about id list, it should be ordered from the root the leafs. Thank you to BalusC for the find component algorithm. public class CustomPartialViewContextFactory extends PartialViewContextFactory { public static class CustomPartialViewContextImpl extends PartialViewContext { private FacesContext facesContext; private PartialViewContext wrappedViewContext;

Categories : JSF

How to start process, then stop later in PHP, MySQL with AJAX
I looks like you want the behavior of ignore_user_abort($bool). But this alone won't help you much as PHP usually have a time limit of 30 seconds. set_time_limit($seconds) probably will help you with this. Keep in mind that the script will run on your webserver and the user will not have any way to kill the script if they make a mistake, so don't forget to add extra checks so your users don't spawn the script 10 times and let it run, especially if it's making phone calls! I'd suggest making a server script that runs outside of the web server, so you can communicate with the daemon and start/stop jobs on it. It's faily easy to do with simple sockets.

Categories : PHP

return value of the function that is called in ajax process
Sure, it's passed to the function you set as the success handler: $.ajax({ url: 'myUrl.com', success: function(data) { console.log(data); //shows data returned from server } })

Categories : PHP

Should JSF process non rendered components on Ajax re-rendering?
This is the expected behaviour as per my comment above. Unfortunately it comes with some ugly behaviour. If you an object that is doing anything when using the list, it will work fine on your first request. Even if you have taken your precautions say by loading something with f:event this will not save you on the following AJAX request. Example: If you use JPA with each bean managed for the scope of the request and that bean has a lazy collection that is not rendered this will cause the following: Request 1: Non-rendered components will not be touched i.e. Lazy collections will not initialize Request 2(Ajax): JSF will try to restore the full view calling your non-loaded lazy collection resulting to an exception.

Categories : JSF

"Fire and forget" a process from a Python script
Since you mentioned os.system, I think it's worth to mention that you should have used os.spawn* with mode P_NOWAIT to achieve the "forget" part. But subprocess module provides replacements for os.system, os,spawn*,etc so you should use that instead like so import subprocess p = subprocess.Popen("./child.py") print "pid = ", p.pid See Replacing os.spawn with subprocess.Popen As I explained in the comments both processes parent.py and child.py are still on the same process group and therefore the terminal will forward signals (like Ctrl-C) to all process in the foreground process group so both will get killed when you Ctrl-C. So if you don't want that you can force child.py to be in a new process group with the following: #!/usr/bin/env python import subprocess import time import

Categories : Python

shell script process termination issue
SIGKILL cannot be trapped by the trap command, or by any process. It is a guarenteed kill signal, that by it's definition cannot be trapped. Thus upgrading you sh/bash will not work anyway.

Categories : Shell

Ruby Script to Process each line in an SQL file
You're calling each_line so you're only getting one line at a time. Given that, I trust it's clear why you're seeing the results you're seeing. Since there are only a 1000 sections like this, you can read in the entire file and do a global replace with capture groups to get the result you want. I couldn't get the regex to work on regexplanet, which supports replacement, but you can see the match groups working at http://rubular.com/r/ahSEerTEnW. After doing the match, you could construct the new replacement text using literals combined with the match group references (1, 2, 3, 4), as in: 1 <ul class="navlistjdxcms"> 2 <li>3</li> <li>4</li>

Categories : Mysql

shell script to process a folder path
Spaces are not allowed in variable assignation in shell, so : #!/bin/sh P='/mnt/temp/' echo "$P" Q=$(echo "$P" | sed -e "s/^.*(.)$/1/") echo "Q is $Q" echo "${P%?}" And use more quotes, see http://mywiki.wooledge.org/Quotes http://mywiki.wooledge.org/Arguments and http://wiki.bash-hackers.org/syntax/words

Categories : Shell

How can I get process.env.PORT from a bash script for cloud9?
$PORT gives you the variable PORT from current shell environment. It could be different for the process. To get the variables from the started server's environment you must know its pid. Then you can run cat /proc/pid/environ //or more readable xargs --null --max-args=1 echo < /proc/pid/environ Replace pid with the value of server process's pid. You can then extract the PORT variable from above.

Categories : Node Js



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.