w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Starting VB Script from Powershell script - works from PS environment, but not scheduled task
Try running this batch script as a scheduled task: @echo off setlocal set "programdir=C:Program Files (x86)LNGoogleCalSync" set "script=%programdir%lngsync.vbs" pushd "%programdir%" wmic process get commandline | findstr /r [l]ngs >nul || cscript "%script%" popd If that doesn't work: try replacing all MsgBox statements in the VBScript with WScript.Echo.

Categories : Powershell

How to add the script to the top of script list in Joomla 2.5
You'll need to modify your template's index.php file. The following includes Joomla's head section: <jdoc:include type="head"/> Simply move $doc->addScript after this (or before it) to set which loads first. Files load top to bottom, so whatever is on top will load first.

Categories : PHP

Starting activity which is already running
use view.setVisibility(View.Gone); it will remove the button from the screen. e.g: Boolean loginControl = getIntent().getBooleanExtra("confirmation",false); if (loginControl) { ViewGroup layout = (ViewGroup) ButtonClick2.getParent(); toBeRemovedButton.setVisibility(View.Gone); } To restart the current activity you can simply finish and recreate it using intent as usual. but remember after recreation, the oncreate() will be called again and the layout will be refreshed including views that you might have removed.

Categories : Java

Starting up Service with AlarmManager , which already might be running
Instead of starting service by AlarmManager use broadcast. Set AlarmManager to send some broadcast intent. Create your own BroadcastReceiver that will receive that intent and in onReceive method restart(stop and start) service. //Start AlarmManager sending broadcast Intent intent = new Intent(context, MyBroadcastReceiver.class); // explicit peningIntent = PendingIntent.getBroadcast(context, 0, intent, 0); mAlarmManager.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), 30 * 1000, pendingIntent); . //BroadcastReceiver public class MyBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Intent serviceIntent = new Intent(SynchronizationService.class.getName()); context.stopService(serviceI

Categories : Android

Keep my thread running when starting new intent
The OnPause event of a class extending Activity is always called when you start a new Activity, that is what you are doing with startActivity(intent). If you want that your thread stop downloading data when you exit the application, that's what I think is the meaning of your myThread.interrupt() into the OnPause callback, do not use "OnPause" but choose another event. You can find a nice description of what events are started when here: Activity lifecycle

Categories : Android

Joomla 3.1 setup on Ubuntu 12.04 running nginx
The permissions when t3 installs are correct, it sounds like the problem is with ownership rather than permissions. I think in ubuntu the system user is www-data so you would need to run the following over ssh chown -hR www-data:www-data /path/to/joomla/root Then upload the plugin through the joomla installer (and change folder permissions back to 755 and files to 644).

Categories : Joomla

Joomla getItems running out of memory with big results set
I fixed it in the end by copying the getPagination, getTotal, getItems etc. from the library's (list.php) and into my model (to override them). Then in each method, I made sure the results where returned instead of sending them to the cache. The getTotal function seems to count the number of rows instead of doing a seperate count(*). That's ok with a few thousand records but over 1/2 million is asking for trouble!

Categories : Caching

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

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 SSH Agent when starting Git Bash on Windows
In a git bash session, you can define a ~/.profile or ~/.bashrc (with ~ being usually set to %USERPROFILE%), in order for said session to launch automatically the ssh-agent. This is what GitHub mentions in "Working with SSH key passphrases". But see "getting ssh-agent to work with git run from windows command shell" for a complete script setting your ssh-agent correctly on Windows. Although the more recent GitHub Auto-launching ssh-agent on msysgit is more robust and does a better job checking if the agent is running or not: if ! agent_is_running; then agent_start ssh-add elif ! agent_has_keys; then ssh-add fi

Categories : Windows

using joomla accounting in another php script
<?php define( '_JEXEC', 1 ); define( 'DS', DIRECTORY_SEPARATOR ); define('JPATH_BASE', dirname(__FILE__)."/../../../bt-travel/"); require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' ); require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' ); require_once ( JPATH_BASE .'/libraries/joomla/factory.php' ); $mainframe =& JFactory::getApplication('site'); $mainframe->initialise(); $user =& JFactory::getUser(); if(!$user->guest){ // *** check if database connection parameters file exists if(!file_exists('include/base.inc.php')){ header('location: install.php'); exit; } ## uncomment, if your want to prevent 'Web Page exired' message when use $submission_method = 'post'; // session_cache_limiter('private, must-revalidate'); // *** set flag that

Categories : PHP

appium script starting off
Here are some links to get started provided from people working on Appium. Some documentation is not up to date since this is still pre Appium 1.0 but should be updated by May 1st. http://appium.github.io/training/ https://github.com/appium/appium/tree/master/docs

Categories : Android

Activity life cycle creating,starting and running procedure
No. If you "sleep" your first Activity, assuming you are talking about the UI thread and not a background thread, then your whole UI will sleep for that time...meaning your second Activity won't be started yet and your song won't play. What you could do is put it all in one Activity and put your image and calculator in the same position, or wherever you want in the layout, and hide your calculator from the beginning in your xml with android:visibility="invisible" // or gone depending on what you need Then you can change the visibility of both views when you need. I don't know exactly what you want so I don't know if this solution is suitable. You also could look into putting your song in a Service

Categories : Android

Script which allows to know Joomla 3 configuration.php details
Joomla has is own method of getting variables from the configuration.php file however do use with caution: $config = JFactory::getConfig(); echo 'Site name is ' . $config->getValue( 'config.sitename' ); echo 'Site name is ' . $config->getValue( 'config.offline_message' ); echo 'Site name is ' . $config->getValue( 'config.dbtype' ); and so on. Hope this helps

Categories : PHP

php function script not getting called in joomla
where you defind $mosConfig_live_site value try to read http://docs.joomla.org/Creating_a_simple_module also try to give full url/path on your each included files like:- JURI::root().'css/joomla.css';

Categories : PHP

Joomla Form to External Script
Don't put ?state=processing in action attribute of the form. Somewhere inside the form (preferably in the beginning or in the end) put: echo '<input type="hidden" name="state" value="processing"/>'; // XHTML assummed

Categories : PHP

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

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

jquery-script don't work in joomla 2.5 template
I think, your problem is caused by jquery-mootools conflict (they both use the $) the problem is discussed in the following question: How to fix Mootools and jQuery conflict on Joomla aiContactSafe

Categories : Jquery

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 can I avoid multiple starting of a bash script?
There are quick-n-dirty solutions that use ps with grep (don't do this). It is better to use a lock file as a "mutex". A nice way of doing this is by using a directory as a lock file (http://mywiki.wooledge.org/BashFAQ/045). I would also suggest taking a look at: http://mywiki.wooledge.org/ProcessManagement#How_do_I_make_sure_only_one_copy_of_my_script_can_run_at_a_time.3F , which mentions use of setlock(http://cr.yp.to/daemontools/setlock.html) that abstracts the lock file handling for you.

Categories : Bash

starting a python 3.3. script at ubuntu startup
The shebang line #!/usr/bin/python3 should work if sh, bash, etc. is trying to launch your script. It it is being run from another script as python myscript.py you'll have to find that script and get it to launch the script using python3 myscripy.py

Categories : Python

Starting Gitlab with init.d script (gentoo)
There are two problems here. Firstly, rvm is normally only loaded by the user's shell and that shell isn't being invoked here. Secondly, bundle won't be in the PATH either. To fix both problems, assuming this is a per-user rvm installation, try this... ... --exec /home/gitlab/.rvm/bin/rvm -- default do bundle exec ... As a side note, you shouldn't use unicorn_rails with Rails 3 applications. Just use plain unicorn instead.

Categories : Misc

how to pass an argument to a python script when starting with nohup
In general, the argument vector for any program starts with the program itself, and then all of its arguments and options. Depending on the language, the program may be sys.argv[0], argv[0], $0, or something else, but it's basically always argument #0. Each program whose job is to run another program—like nohup, and like the Python interpreter itself—generally drops itself and all of its own options, and gives the target program the rest of the command line. So, nohup takes a COMMAND and zero or more ARGS. Inside that COMMAND, argv[0] will be COMMAND itself (in this case, '/usr/bin/python'), and argv[1] and later will be the additional arguments ('/home/path/to/script/script.py' and whatever $BUCKET resolves to). Next, Python takes zero or more options, a script, and zero or more ar

Categories : Python

When running Python's pdb as a script, how do I autostart the script?
that's probably not the way to do to it. you should modify/extend the existing pdb.py. the code looks like this: while True: try: pdb._runscript(mainpyfile) if pdb._user_requested_quit: break print "The program finished and will be restarted" except: traceback.print_exc() print "Uncaught exception. Entering post mortem debugging" print "Running 'cont' or 'step' will restart the program" t = sys.exc_info()[2] pdb.interaction(None, t) print "Post mortem debugger finished. The "+mainpyfile+" will be restarted" it looks like you could replace `pdb._runscript(mainpyfile)' with something like runpy.run_module(sys.argv[0], run_name="__main__", alter_sys=True) (from PEP 338). not a complete solutio

Categories : Python

Running a variable script with parameters through a script
If you do this: #!/bin/sh for app in "$@"; do sh "jboss-$app" restart done Then you can pass a space-separated list of app names to the script ./restart-apps app1 app2 app3 ...

Categories : Shell

java input.readLine hangs after starting a powershell script
Use a ProcessBuilder. Any process implying a modicum of I/O should outright refuse to run via Runtime.exec(), alas, it cannot detect that. And Oracle hasn't flagged it as @Deprecated which is a pity. Anyway: final File logFile = new File("/path/to/logfile"); final ProcessBuilder pb = new ProcessBuilder("powershell", "/path/to/the/ps1"); pb.redirectOutput(Redirect.to(logFile)); pb.redirectErrorStream(true); final Process p = pb.start(); final int retcode = p.waitFor(); // deal with retcode // read result from the log file

Categories : Java

[three.js]: script running in IE10, not running as HTA
Okay, problem understood... solution is tricky. When using Three.js code within an HTML application (HTA), then the HTA uses IE7 quicks mode by default. You can easily add the following line to the Three.js HTA: <meta http-equiv="X-UA-Compatible" content="IE=IE10" /> But then, no more HTA mark-up is understood (windowstate, applicationname - to mention just a few) since the MS IE team wants to "focus more on standards" :-( But there is a trick which works... Create an empty HTA using all the mark-up code that you like, for example: <hta:application windowstate="minimize" border="none" icon="myIcon.ico" /> Do NOT use the IE10 X-UA-Compatible meta statement here. Create an onload javascript function within that HTA that loads the THREE.js HTML page to document.location.

Categories : Internet Explorer

How to resolve this error in joomla 1.5Illegal variable _files or _env or _get or _post or _cookie or _server or _session or globals passed to script
Sorry, but I think you should update Joomla. The 1.5 is a very old version and uses obsolete PHP and MySQL functions. I suggest you to back up the website data and upgrade joomla to 2.* . Joomla! 1.5 has also got some SQL injection problems. Hope to be useful, bye.

Categories : Misc

Joomla CiviCRM add duplicate field in joomla front-end profile form
CiviCRM does not support adding multiple website fields into a profile. You can add a custom field to the profile to hold an additional website. If you want to write a little code you can sync that to the website field with a hook. See Hook Reference as well as Example Joomla Hook Plugin Setup

Categories : Joomla

Email Form Module in Joomla 3.1 - Uses Joomla Mailer and PHP
Not sure if you already got it working but recently I was trying the same thing by creating my first module and struggled quite a bit initially. I can see following couple of things that needs correction in you code: - The first file (that's mod_contact.php) in your case statement for variable "c_send" you are looking for value 'true' to be sent on form submission but you are sending value 'send" in your default_tmpl. You need to either compare string with "send' or send a value of "true" from default_tmpl. - In the tag skip the action part completely to return back to mod_contact.php. Hope that helps.

Categories : PHP

joomla json like string... what is it? smarty? joomla core?
It's generated by serialize. You can unserialize it. Example: $array=unserialize('a:10:{i:0;s:2:"76";i:1;s:2:"77";i:2;s:2:"82";i:3;s:2:"83";i:4;s:2:"87";i:5;s:2:"89";i:6;s:2:"92";i:7;s:2:"93";i:8;s:2:"94";i:9;s:1:"0";}'); Output: Array ( [0] => 76 [1] => 77 [2] => 82 [3] => 83 [4] => 87 [5] => 89 [6] => 92 [7] => 93 [8] => 94 [9] => 0 )

Categories : PHP

Adding Joomla menu for new component directly in DB (Joomla 2.5)
Try This, On Joomla 1.6 onwards the component details storing table is #__extensions Also you have set the details #__menu table too. Hope this may help you..

Categories : PHP

how to call a joomla! module in a php page OUTSIDE joomla! directory?
I've never had to do this, but first I think you would have to load the Joomla framework (see the installations root index.php) then you would have create a session using Jsession. This is just a guess so take it for what its worth.

Categories : Joomla

Don't run script if it's already running
Try using ignore_user_abort(true); it will continue to run even if the person leaves and closes the browser. you might also want to put a number instead of true false in the db record and set a maximum number of processes that can run together

Categories : PHP

running pig script
I have not used node.js. But here I find a link to show how to execute a unit command in node.js: http://www.dzone.com/snippets/execute-unix-command-nodejs For example, if you want to run a pig script called foo.pig. Then you can try the following code: var sys = require('sys') var exec = require('child_process').exec; function puts(error, stdout, stderr) { sys.puts(stdout) } exec("pig -f foo.pig", puts); You can replace pig -f foo.pig to any command that you use to run your pig script.

Categories : Node Js

Running a PHP script
What you need to do is to fork the process before you terminate it. This way when you exit the process (or close your ssh connection) the secondary process will continue to run. $pid = pcntl_fork(); if ($pid == -1) { die('could not fork'); } else if ($pid) { // parent pcntl_wait($status); } else { // child // write your code here! }

Categories : PHP



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