w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
While Sending Html Mails from my web application Recieved Mails contains Symbols like &ldquo,&rdquo, ‘
Check with another constructor for htmlView: ContentType mimeType = new System.Net.Mime.ContentType("text/html"); var htmlView = AlternateView.CreateAlternateViewFromString(bodyMessage, mimeType);

Categories : Asp Net Mvc

css circles using border radius need to change the color of intersected section of circles
The short answer is that what you're asking for isn't possible recommended in CSS. At least, not in any sensible way (given enough markup, I guess anything is possible, but that's not really what you're asking). It is possible to get slightly closer to your intended result by using opacity; make the circles semi-transparent, and it will give the overlapping segments a blended colour from the two overlapping colours. But that's not what you want either. To get anything beyond that using CSS will be extremely difficult, and to be honest, probably not worth it. Modern browsers have features like SVG built into them which allow you to create rich graphic effects, so there's really no reason to be trying to do this kind of thing in CSS at all. Just use SVG for this and you'll be fine.

Categories : CSS

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

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

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

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

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

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

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

[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

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

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

Why isn't my 'cycle' script running?
Also include Jquery.min.js <script type="text/javascript" src="scripts/jquery.min.js"></script> before your cycle.js Wordpress has already Jquery Loaded so you can remove your jQuery.js from your script and try ..I suppose its mere Jquery Conflict

Categories : Javascript

Keep UI updated while script is running
You can try researching WebWorkers. Or you can split your work into separate chunks and call each chunk after the next using setTimeout with a timeout of 0. setTimeout( function() { executeNextChunk(); }, 0 ) This gives the browser time to do other stuff in between invocations.

Categories : Javascript

Running exec in a script
exec will only give you the last line ... your probably want to use passthru <?php if ($_GET['run']) { # This code will run if ?run=true is set. passthru("./check_sample.sh"); } ? For passing parameters you can just form the add it to the command like this. (escapeshellarg will handle the escaping and quoting of the value for you) passthru("./check_sample.sh ".escapeshellarg($_POST["fieldname"])); If you need the output as a string your options are to use popen or surround the passthru in an output buffering block: ie: ob_start(); /* passthru call */ $data = ob_get_clean();

Categories : PHP

Running two scripts as one script
You have already identified the basic problem: The need to run the sending and the receiving concurrently. You must delve into multi-threading. The basic design pattern could be: Create a thread for the receiving part with a flag for cancelling it. Loop infinitely doing the following: check to see if there is inbound data; if there is receive it and output it; sleep a timeout; break if the cancellation flag is set. On the main thread, create your receiver and start it, then enter your input loop: If the user inputs a message, send it on the same thread. If the user types 'exit', set the cancellation flag on the receiver thread, wait for it and exit. More or less: class Receiver (Thread): def __init__ (self): super (Receiver, self).__init__ () self.cancelled = False

Categories : Python

Running a php script with a .bat file
The START command optionally accepts a title for the created window as its first argument; in this case, it thinks that C:Program Files (x86)PHPv5.3php.exe is the title to display and -f (the second argument) is the executable you want to run. You can therefore fix this by providing a placeholder title, e.g. start "email reminder task" "C:Program Files (x86)PHPv5.3php.exe" -f C:inetpubwwwrootsitenamecrons eminder-email.php Or, preferably, you can ditch the START command altogether (you aren't using any of its unique facilities) and just run PHP directly: "C:Program Files (x86)PHPv5.3php.exe" -f C:inetpubwwwrootsitenamecrons eminder-email.php

Categories : PHP

Running a script for certain days
Put this in your crontab: */20 * * * * bash /path/to/your/script.sh Then remove it after 10 days. Better yet, have your script check the current date and send you an email when it's 10 days from now to remind you to remove it. You could also just have the script remove the line from the crontab (or just remove the crontab file if it's only got this one line) after 10 days.

Categories : PHP

Running a script from within a shell
the sage shell is a process running in the foreground and due to the sequential nature of your script, the sage shell has to finish running before the next line of the script is executed. It is after the sage shell exits that the easy_install line is run. The script is performing as written.

Categories : Python

Error on running database script
ALTER DATABASE [MYDATABASE] SET COMPATIBILITY_LEVEL = 100 SQL Server 2005 doesn't have this command yet - new feature of SQL Server 2008. You need to use this instead: EXEC sp_dbcmptlevel AdventureWorks, 90; Level 90 = SQL Server 2005 - that'll work; level 100 is SQL Server 2008 which will not work in SQL Server 2005 obviuosly..... ALTER DATABASE [MYDATABASE] SET HONOR_BROKER_PRIORITY OFF EXEC sys.sp_db_vardecimal_storage_format N'MYDATABASE', N'ON' Those are both new features in SQL Server 2008 or newer and don't have any equivalent in SQL Server 2005. The vardecimal storage format isn't supported (nor needed) in SQL Server 2005.

Categories : Sql Server

Script is not running at the same time as the loop
Definitely your addGraph complete function gets called asynchronously. You can work around this like this. <script> console.log ("LOOP"); var impressions = [<?= implode(",", $prod_impression_dots) ?>]; var testdata = [ { "key" : "Impressions" , "type": "line", "values" : impressions, "yAxis": 1 } ].map(function(series) { series.values = series.values.map(function(d) { return {x: d[0], y: d[1] } }); return series; }); nv.addGraph((function (testdata) { return function() { console.log ("Add graph is called here"); console.log (testdata); var chart = nv.models.multiChart() .margin({top: 30, right: 60, bottom: 50, left: 70}) .x(function(d,i) { return i })

Categories : PHP

Testing php code while running script
You don't want to do such a thing, because it will immensely slow down your software. Typically your software (and your tests) only changes when you deploy a new version to your production server. You could use an continues integration (CI) server which you can configure to automatically run your testsuite whenever you commit to VCS or before you deploy.

Categories : PHP

The script is running from terminal but not from crontab?
You have a literal carriage return in your command line (created by some errant editor or a Windows user or some such): $ python nosuchfile.py python: can't open file 'nosuchfile.py': [Errno 2] No such file or directory $ python nosuchfile.py^M ': [Errno 2] No such file or directory (the ^M above, I created by typing control-V control-M, where control-V is my "lnext" character). The error message prints the file name, including the carriage return, and then the rest of the characters overwrite the initial part of the error. Note that if you make the file name just a bit longer, you'll see part of it: $ python verylongfilenamethatdoesnotexist.py^M ': [Errno 2] No such file or directoryamethatdoesnotexist.py To fix it, open the crontab entry/file with an editor that lets you take out

Categories : Python

How to detect a running script on windows?
You can use the isAlive method on the thread to check if it is already running. On similar lines, if you were running a process instead, then you could write a pid file everytime you start the process and query the OS for the status of that specific pid anytime you required. Check the following link for more on isAlive. http://docs.python.org/2/library/threading.html#threading.Thread.isAlive

Categories : Python

Running Groovy class from ANT script
You can't run a groovy script (<groovy src=...) together with inline groovy code. If you do it, the script is ignored and only inline code is executed. You can verify it by switching def checkoutClass = new Checkout() checkoutClass.init = {-> true} with println "hello" In order to execute your script, just remove those two lines above. Your script code should look like this: ant = new AntBuilder() ant.typedef(resource: 'org/tigris/subversion/svnant/svnantlib.xml'){ classpath { fileset(dir: libDir, includes: '*.jar') } } ant.echo("INIT") pomFile = args[0] svnRoot = args[1] svnProjectDir = args[2] jenkinsWorkspace = args[3] libDir = args[4] queryFile = args[5] startCheckout()

Categories : Groovy

Undefined Variable by running a script on PHP 5.4 and IIS 8
You declare $dnas_data in a method, so it won't be accessible outside that method. I would suggest you to declare another member variable for storing the data: class RadInfo { private $db; private $cfg; private $dnas_data; And replace every occurrence of $dnas_data by $this->dnas_data I just looked again at your GetServerTitle() method: return($this->openstats($dnas_data['SERVERTITLE'])); Do you really want to call openstats() again? Change this to : return $this->dnas_data['SERVERTITLE'];

Categories : PHP

How can I update the current script before running it?
Yes, you can update the script you're running, then execute it again. (Just make sure to exit the first script after updating.) Here's some sample code I created: Write-Host "Starting script" if ($(Get-Item G:selfUpdater2.ps1).CreationTimeUtc -gt $(Get-Item G:selfUpdater.ps1).CreationTimeUtc) { Copy-Item G:selfUpdater2.ps1 G:selfUpdater.ps1 $(Get-Item G:selfUpdater.ps1).CreationTimeUtc = [DateTime]::UtcNow &G:selfUpdater.ps1 exit } Write-Host "Continuing original script; will not get here if we updated." Note that, if you have parameters to pass around, you'll have to pass them to the target script. Since your updated script may well have more or fewer parameters than your current script (some bound, some unbound by the current script), you'll need to iterate through

Categories : Powershell

Running Scrapy from a Shell Script
Perhaps you actually need to run the script in ~/.virtualenvs/email-scraper/. Do cd ~/.virtualenvs/email-scraper/ before running it. When you're there run sh sitecode/runspiders.sh Or sudo sh sitecode/runspiders.sh #!/bin/bash cd /home/pi source ./bashrc ## source /usr/local/bin/virtualenvwrapper.sh ## You didn't run this. workon email-scraper cdvirtualenv cd ./sitecode/jobscraper scrapy crawl site1 Run as bash script.sh, not sudo sh script.sh.

Categories : Bash

Glitch when running homemade script CMD
where is your procedure definition and it's call ? you shoud have done someting like : echo parsing ... call :delay 3000 echo reading ... call :delay 3000 exit :delay ping 1.1.1.1 -n 1 -w %1 > nul

Categories : Batch File

bat file running py script in different directory
Ultimately there needs to be some way to tell your script what you are needing to process. There's a variety of ways for that, but it really just needs to happen. I think the most obvious thing to do in the batch file is to copy the target file in place before running your Python script. However, a cleaner solution might be to take a command line argument into the python script (via sys.argv) which tells the script which file it needs to process.

Categories : Python

Check if server running script?
First find IP address of the machine requesting the link by: if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip = $_SERVER['REMOTE_ADDR']; } Now $ip is IP address of the requesting machine. And let's say your computer IP is 123.456.789.1 (something like that) So let's assign it to a variable $server_ip = "123.456.789.1"; Now if($ip == $server_ip && isset($_GET['reloadImages'])){ echo "<img src="site.com/image.jpg" />"; exit; } else{ echo "Sorry! you cannot see"; }

Categories : PHP

302 Found when running the Perl Script
You print your HTTP header here: print $q->header Then you print another HTTP header here: print $q->redirect($client->get_login_url()); An HTTP message can have only one set of headers. If you're sending a 302 redirect, then there's no need to print any HTML either, so get rid of all of this: print $q->header, # create the HTTP header $q->start_html('Facebook App'), # start the HTML $q->h1('Facebook Authentication'), # level 1 header $q->end_html; # end the HTML

Categories : Perl

UIAutomation script not running on device
I had the same problem and then (eventually) figured it out. Turns out the build has to be a DEBUG build so that instruments can attach to it. I edited the scheme build settings for "build for profiling" so that it would build a DEBUG build rather than a RELEASE build and things started working.

Categories : IOS

Xdebug interrupts the running of PHP script
500 (Internal Server Error) in phpstorm 9.0 when enabling xdebug breakpoints. Validate your whatches for php session. Errors in whatches can generate errors in executing php code. Errors disapears when you disable xdebug listening or correct/remove whatches.

Categories : PHP

JSF rendering and running order
I would just use jQuery: <tr:document> <trh:script source="jquery.js"></trh:script> <trh:script source="your_script.js"></trh:script> ... </tr:document> You can then just execute your script on page load (.ready): $(document).ready(function(){ // Your stuff here }); If you are using Ajax (Trinidad Partial Page Rendering), you might want to add a state change listener in your Javascript. For example: TrPage.getInstance().getRequestQueue().addStateChangeListener(function(state){ if (state == TrRequestQueue.STATE_READY){ // Your stuff here } });

Categories : Java

Java not running shell script
Verify two things: If you have modified the perl script, make sure it has #!/bin/perl in the first line, same for your shell script, it must have #!/bin/sh or #!/bin/bash if you are specificaly using bash. Your moved files must have executable permissions, change them with something like .chmod 755 myFile.

Categories : Java



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