w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Running python script on crontab is causing permissions errors but running via terminal is fine
@Lucas Ou-Yang @Hyperboreus as Hyperboreus said it depends on the user privilege who run it . i think that if you give the /tmp/ dir a 777 permission from the root account it'll be fixed : chmod 777 -R /tmp/ okay try with : chmod 777 /tmp/ if the error still check if the directory /tmp/ exist !

Categories : Python

Running a function on a remote server via SSH in a script
There's no straightforward way to do that. But you can extract all the function definitions and inject them as a command at the beginning of your remote command: ssh "$user@$machine1" "$(declare -f); main" Notice that you still might have problems with global variables and other resources.

Categories : Function

Remote button click (cgi script running)
When you click the button on the webpage, the browser will send to a request to a specified url ( http://91.137.148.13:8000/leds.cgi?led=0 ). So you can send a request to this url when user clicked the button in your Android app. private class exampleHttpTask extends AsyncTask<Integer, Integer, String> { public String convertStreamToString(InputStream is, String charset) throws IOException { if (is != null) { Writer writer = new StringWriter(); char[] buffer = new char[1024]; try { Reader reader = new BufferedReader(new InputStreamReader(is, charset)); int n; while ((n = reader.read(buffer)) != -1) { writer.write(buffer, 0, n); } } finally { is.close(); } r

Categories : Android

How do I keep the WebBrowser control from catching exceptions and displaying them as script errors?
I didn't end up with a universal solution, but this one works well enough for me. Communication between the browser and my application is only done through a single Javascript method. So I just wrapped all of the code in that method in a try/catch block and threw the exception on another thread. [ComVisible(true)] public class JavascriptBridge { public void Notify(string data) { try { // Process the data } catch (Exception ex) { System.Threading.ThreadPool.QueueUserWorkItem((state) => { throw new Exception("An unhandled exception ocurred while servicing a Javascript method call.", ex); }); } } } This completely bypasses the browser control's exception handler and retains the original exception's loca

Categories : C#

Monit errors when running "check program" for custom script
ok, fixed. for future reference for anyone reading this -- never put .sh files in /etc/monit.d/ that was the problem. i moved the .sh file to a different directory and everything is fine now.

Categories : Misc

Facebook like button/box causing "Stop running this script" errors in IE8
we had the same issue on website. It started to happen from yesterday 04/07/2013. It only happens in IE7 browser. We just omitted the browser from showing the Like box with below code. if (navigator.appVersion.indexOf("MSIE 7.") == -1) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }

Categories : Facebook

Running a remote binary via a bash script is hanging if I give certain command line args
Put the ssh command in the background, not the remote command. for host in A B C do ssh user@$host " function test { cd /path/to/foo ./foo_exe --optA > run.out 2>&1 }; test" & done wait The reason is that ssh is waiting for the server to close the network connection before it exits. It doesn't go into the background just because the remote command is in the background. BTW, have you heard of pssh? http://www.theether.org/pssh/

Categories : Bash

how to control other scripts by a main script and pass to them parameters when they are running
I'd say that PHP isn't the best tool for what you're trying to accomplish. Why don't you write a program in C or Visual Basic or something? But it's solvable in PHP too: I'd suggest to create your own error-handling function and assign it in test.php via the set_error_handler('my_custom_error_function') function. In my_custom_error_function() you can log the error and restart test.php Appending a line to a logfile can be done via file_put_contents('.error.log', $error_string, FILE_APPEND) fgets() expects an open file handle. So you may want to check your routines (or provide more code). You may want to look into file_get_contents() too.

Categories : PHP

Running script on a remote server in bash working on 1 server, not on the other
It's just a guess but i would try this filename=hostnames > export.log while read -r -a line do hostname=${line//"} echo $hostname":" >> export.log ssh -t -t $hostname "bash -s" < script.sh >> export.log & done < "$filename" exit Just to make sure you don t get stuck on one server.

Categories : Bash

Hudson server running app engine, duplicate shell script executions result in duplicate property errors
It might be the case that the dev_appserver is already running and then you run it again with hudson job. The best way will be to stop the dev_appserver instance first and then pump it up again.

Categories : Python

executing a perl script on a remote machine as a root and getting the output back into the webpage using javascript
To initiate a command from a web page, issue an AJAX call to another CGI script running on your webserver. AJAX call can return the results of running your command (typically in JSON or XML format) and then call up some JavaScript handler to render that data in your page's DOM. To run something as root on the web server's unix machine locally, you will need an suid script to be called from your CGI script mentioned in the first bullet (since web server and all the scripts it runs are typically run as non-root for security reasons). To run something as root on ANOTHER machine, you have correctly found that you need to use ssh (from that same CGI script): ssh root@your_remotehost "perl pathto/perlfile.pl" You will need to set up the ssh keys correctly between 2 systems so ssh doesn't ask

Categories : Javascript

I am trying to install my rails app onto a Ubuntu 10.04 box running in Vagrant (Virtualbox). I'm running into the following errors
The latest version of devise 3.0 fixes my devise errors. I am going to close this in favor of breaking out the second capybara error at Problems installing capybara-webkit 1.0.0 in Rails 3.2.10 on Ubuntu 10.04

Categories : Ruby On Rails

Perl script suffers random __fortify_fail errors, but continues to run without any errors. Should I be worried?
Given the updated screen shot in your most recent edit, it appears there's a bug in an XS module overflowing a buffer, and that's what the stack backtrace is complaining about. You can see in the screen shot the backtrace: /lib64/libc.so.6(__fortify_fail+0x37)[0x7fb026838637] /lib64/libc.so.6(+0xf8690)[0x7fb026836690] /home/ex2-user/j_authority/_Inline/lib/auto/author_da35/author_da35.so(profiles_c+0x27fd)[0x7fb008a529ad] /home/ex2-user/j_authority/_Inline/lib/auto/author_da35/author_da35.so(XS_author_profiles_c+0x32a)[0x7fb008a55afa] So, it appears you're in the middle of this XS module when Fortify detected a stack overflow. This suggests a function-local array to some function internal to author_da35 got overrun. This could happen if, for example, it sized some structure expecting

Categories : Perl

Binding Escape key (ESC) in Emacs running in Console (-nw)
The behavior seems fairly involved as it is in the core of emacs to have this translation: http://www.gnu.org/software/emacs/manual/html_node/elisp/Prefix-Keys.html The behavior in evil happens in the following file: http://gitorious.org/evil/evil/blobs/master/evil-core.el

Categories : Emacs

How can I escape the my c# script to add html tags?
You can just do this: <%# DataBinder.Eval(Container, "DataItem.cptUID") == selectedCpt.Value ? "TRUE" : "<font color="red">FALSE</font>" %></span></td> Or this: <%# DataBinder.Eval(Container, "DataItem.cptUID") == selectedCpt.Value ? "TRUE" : @"<font color=""red"">FALSE</font>" %></span></td> Further Reading string (C# Reference): Contains many examples of escaping regular and verbatim strings

Categories : C#

How to pass output from remote script to local script in bash
On your local script, in your ssh line, you can redirect some of the outputs to a file with tee: ssh ... | tee -a output.log If you want to filter which one goes to the output.log file, you can use process substitution: ssh .... | tee >(grep "Some things you want to filter." >> output.log) Besides grep you can use other commands as well like awk.

Categories : Bash

Escape curly braces in Google Script
Try var url = "https://api.insight.ly/v2/Opportunities/" + encodeURIComponent("{217}"); The { must be encoded as %7B and } as %7D. You can hard-code those if you like, but it's nice to be able to see the actual string in the source code.

Categories : Javascript

How to escape the "." reserved symbol when using an input for an sql script
While i waited for an answer i found the following solutions: "set define off" and using . OR "set escape ON" and using . And turning the properties to its default value after using them. I ended up using Nicholas Krasnov's solution of using a "&1..TABLEX" because it didnt require any property change. Thank you!

Categories : SQL

Remote script as content script in Chrome extension
$.getScript defaults to injecting a <script> element to load scripts from a different origin. Consequently, the code runs in the context of the page, not the content script (see also). If you really want to use jQuery to get the script, replace $.getScript("https://mysite.com/myremotescript.js", function(){ }); with the following (eval is used as a callback, thus it evaluates the response of the request) $.get("https://mysite.com/myremotescript.js", eval); While this works, I recommend to cache the script's response body. Then, your extension will not break if the network connection drops. And, more importantly, the user will not get a useless request for every page load. I've fleshed out this concept before, see this answer.

Categories : Jquery

How to escape space in script shell sh for defaults write value?
Try to use: output=$(git log | head -n 3) file=$(echo $PWD)/info defaults write "$file" gitLog -string "$output" if you want store 3 lines of text as "one string". Or the next: OIFS=$IFS IFS=$' ' declare -a output=( $(git log | head -n 3) ) IFS=$OIFS file=$(echo $PWD)/info defaults write "$file" gitLog -array "${output[0]}" "'${output[1]}'" "${output[2]}" if you want store 3 lines as "array".

Categories : GIT

Running a .py script from bash, how can I pass a python variable back to the terminal once the .py is done running?
You can write your variable and its value into an ini file from the python script. In Values.ini file my_var="value" After executing python script, just invoke Values.ini using . operator . Values.ini Now your shell variable $my_var will be having the assigned value. The advantage with this method is that you can assign any number of variables like this. var1="value1" var2="value2" var3="value3"

Categories : Python

Running pig script gives the error as: job has failed. Stop running all dependent jobs
After some research, I found that the problem here is LeaseExpiredException. This might be because the output of mapper was removed. One of the reason for this might be due to the quota allocated for the user. In my case, I was running this script in a very large data, and my quota was insufficient to process/store the data. We can check the quota by the following command: hadoop fs -count -q /user/username Thank you.

Categories : Hadoop

Selenium::Remote::Driver capture errors
No, that's already how one works with that module. It throws exceptions for every little thing that can go wrong (a design mistake in my book), so you have no other choice but to catch them. Perhaps switch to Try::Tiny if you want syntactic sugar. Since the module errors are untyped strings (another design mistake), you cannot catch specific errors. You have to catch all and parse them.

Categories : Perl

Multiprocessing Remote Server and Socket Errors
Your server code is listening on the loopback network interface 127.0.0.1. This interface is not available from external networks such as an attached ethernet interface. If you want to access your server from any network interface, use an empty host name in your server. m = QueueManager(address=('', 50000), authkey='test')

Categories : Python

Re-installing Linux O.S. and then running bunch of commands in a .sh script , how to stop the script if something fails?
You can check the error code from commands you run #!/bin/bash function test { "$@" status=$? if [ $status -ne 0 ]; then echo "error with $1" exit 255 fi return $status } test ls test ps -ef test not_a_command taken from here for more information Bash Beginner Check Exit Status

Categories : Linux

How to run a script that it has to connect 3 solaris servers, do some operations and create files in the machine where the script is running?
Use sshfs to mount the needed directories of your three servers. Afterwards you can run the script locally accessing the remote data as local files.

Categories : Bash

sys module giving different output when running Python script through IDLE and by double-clicking the script
print os.path.dirname(sys.executable) is what you should use. When you click it it is probably running through python.exe so you are removing the extra char from the w.

Categories : Python

Remote XML file is poorly written causing parsing errors
Try this $data = file_get_contents($url); $data = str_replace(array('<description>','</description>'), array('<description><![CDATA[',']]></description>'), $data); $game = simplexml_load_string($data);

Categories : PHP

Arduino / Android Remote Control
you can reuse the same method for all 4 buttons. Just distinguish them by their ids public void onClick(View view) { String command = null; switch (view.getId()) { case R.id.button1: command = "w"; break; case R.id.button2: command = "a"; break; case R.id.button3: command = "d"; break; case R.id.button4: command = "s"; break; } try { PrintWriter out = new PrintWriter(new BufferedWriter( new OutputStreamWriter(socket.getOutputStream())), true); out.println(command); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printS

Categories : Java

Cron not running Python script is script not in home folder
cron is running crontab(5) entries from the home directory of the user. You need to change appropriately the directory i.e. to call the chdir(2) syscall (either thru the cd shell builtin, or inside your python script using os.chdir). You should query the current directory (using getcwd(3), or the pwd command, or the os.getcwd in Python) in your script. Also check your PATH if running commands.

Categories : Python

How to escape characters in javascript with a space before
You just need: string.replace(/ //g," "); so that you're matching a space followed by an (escaped) forward slash. This has some good examples: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace

Categories : Javascript

New-PsDrive Remote copy from DFS share errors: A specified logon session does not exist
From the looks of things it appears that you are experiencing the dreaded "Double-Hop". If you only what to remote to a few computers it's pretty easy to setup the "fix" for the "Double-Hop". On the computers that you want to remote to you need to run the following commands: Enable-PSRemoting Enable-WSManCredSSP Server Then on the computer you want to remote from you need to run the command: Enable-WSManCredSSP Client –DelegateComputer [<FQDN of the server>][*] In place of the fully qualified domain name you can put a * instead. That will allow you to send your credentials to any computer (that could be dangerous). Now how would you work this into a script? There is a command called Invoke-Command. If you look at the parameters of Get-Help Invoke-Command -Parameter *, you'

Categories : Powershell

error with global name when running a script from another script - python
This is a pretty interesting problem. First a quick workaround, you can provide dictionaries to use as the local and global namespace when calling execfile(), using an empty dictionary for globals works fine: # test_fun1.py a = 1 def test1(): print a execfile('test_fun2.py', {}) test1() Alternatively, if you want the code to execute within the global scope of your module you can use globals() instead of {}. Now on to why this isn't working... from the documentation on execfile(): If both dictionaries are omitted, the expression is executed in the environment where execfile() is called. Here "both dictionaries" is referring to the optional globals and locals arguments to execfile(). In this case "the environment where execfile() is called" is the local scope of the fun

Categories : Python

How does TeamViewer take screenshots and allow remote control without root?
Teamviewer does NOT support taking screenshots or remote control without root. The only Android devices it does manage to pull this off is on Samsung devices This Teamviewer press release shows how it's done. It basically installs this Samsung specific addon from the Play Store. As a background, Samsung got this working to counter Amazon's Kindle Fire's new feature called Mayday. Technically, Samsung basically gave Teamviewer a bunch of special pseudo-root-level certificates and signatures so the app can work seamlessly for everyone. This is how it looks on non-Samsung non-rooted devices [left] and how it asks for Super User access on non-Samsung rooted devices [right] (Click through for original resolution):

Categories : Android

Remote Control for audio doesn't work
It looks like your view controller isn't in the responder chain. That might be due to [self resignFirstResponder] in viewWillDisappear and/or another ViewController is in the front. To make sure you receive these events you can implement a UIApplication subclass which will be able to receive the events always. So it doesn't matter which ViewController is visible. The UIApplication is always in the end of the responder chain. Create a subclass for UIApplication (MyUIApplication) and implements the following UIResponder methods: - (void)remoteControlReceivedWithEvent: (UIEvent *) receivedEvent { ... } - (BOOL)canBecomeFirstResponder { return YES; } In main.m use the following to initiate the app (replace MyUIApplication and AppDelegate with your classes names): @autoreleasepool

Categories : IOS

How can I control form submit remote with variable?
@remote_flag is an instance variable, not the local variable, so it isn't passed to the partial with locals: { user_event: user_event, remote_flag: false } construction. Since it isn't set, it is (by default) nil and it behaves like false in conditional statements. Instead, you should rather use your passed local variable, remote_flag: <%= form_for(current_user.favorites.find_by_followed_event_id(user_event), html: { id: "event_number_#{user_event.id}", method: :delete }, remote: remote_flag) do |f| %> <%= f.submit "Remove from favorites %> <% end %> and pass variable through locals: {...} construction or set an instance variable explicitly in controller: @remote_flag = !!condition

Categories : Ruby On Rails

Escape quotes in Javascript/Chameleon template
You can try this, if this helps "get_sfp('"+${dict_value}+"')" Also from your implementation it seems that the dict_value is the variable you already know. So whats the problem accessing it from the get_sfp function. Sorry couldn't comment as I still don't have that privilege.

Categories : Javascript

javascript - replace method - regex escape necessary?
Make it like this: var word = "thi^s"; var word2 = word.replace(/[^a-zA-Z]/g, ""); console.log(word2); //=> "" Since caret ^ has a special meaning inside character class. [^a-zA-Z] means match anything except upper case and lower case English alphabets.

Categories : Javascript

How can I escape single quotes from get method in Javascript?
You should use php's urldecode on the value. Docs found at http://php.net/manual/en/function.urldecode.php Let me know if that's what you're looking for :)

Categories : PHP

how to create remote actors dynamically and control them by using AKKA
Setting up the whole thing for the first time is a pain but if you do it once you will have a good skeleton that you will user on regular basis. I've written in comment below the question user clustering not remoting. Here is how I do it: I set up an sbt root project with three sub-projects. common frontend backend In common you put everything that is common to both projects e.g. the messages that they share, actor classes that are created in frontend and deployed to backend. Put a reference.conf to common project, here is mine: akka { loglevel = INFO actor { provider = "akka.cluster.ClusterActorRefProvider" debug { lifecycle = on } } cluster { seed-nodes = [ "akka.tcp://application@127.0.0.1:2558", "akka.tcp://application@127.0.0.1:2

Categories : Scala



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