w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Imacros script. Extract data from csv file and fill form
From Imacros documentation: iMacros 7 can use either a comma as CSV separator, or the list separator set in Windows Regional Settings. Change your default separator in Imacros options or change it just for your current script: SET !DATASOURCE_DELIMITER ; SET !DATASOURCE file.csv

Categories : Csv

Android Tasker app looping script not looping
I just got started with tasker, but I've been an Android developer for a while. Most of the time these actions are asynchronous and you may actually be doing these all at the same time without giving the first round enough time to finish. In other words, this process might work if it were blocking, but it may be asynchronous. Maybe try adding in a sleep time after each round? Say, 750ms or something like that, and see what happens?

Categories : Android

Bash script to wait for gnome-terminal to finish before continuing script, only works for first instance of script
#!/bin/bash date bash -c "sleep 7" & bash -c "sleep 5" & wait date As you can see while running this script, both sleep commands will run in parallel, but main thread stalls, while they are running. Sat. Jule 27 01:11:49 2013 Sat. Jule 27 01:11:56 2013 Replace sleep 7 with expect launchneuron.exp and sleep 5 with expect launchmpj.exp and add your plot commands after calling "wait": echo "Simulation Complete" ...(your code to plot results)

Categories : Bash

PowerShell - script 1 calls script 2 - how to return value from script 2 to script 1
You could make use of ProcessStartInfo and Process which would allow you to read the StandardOutput. Here's an example of what you might do: $startInfo = New-Object System.Diagnostics.ProcessStartInfo $startInfo.FileName = "powershell.exe" $startInfo.Arguments = "C:scriptscript2.ps1" $startInfo.RedirectStandardOutput = $true $startInfo.UseShellExecute = $false $startInfo.CreateNoWindow = $false $startInfo.Username = "DOMAINUsername" $startInfo.Password = $password $process = New-Object System.Diagnostics.Process $process.StartInfo = $startInfo $process.Start() | Out-Null $standardOut = $process.StandardOutput.ReadToEnd() $process.WaitForExit() # $standardOut should contain the results of "C:scriptscript2.ps1" $standardOut

Categories : Powershell

bash script: looping over arguments
Use "$@" in your for loop: for i in "$@" do sed -i.bak 's/~/~ /g' "$i" done Though I am not really sure if sed is doing what you've described here.

Categories : Shell

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

unable to access variable declared in ksh script to csh script using shell script
The ksh script is not doing what you think it is doing when used by ksh; it sets $1 first to MyUser=root and then MyPassword=shroot. However, when you source it from your C shell script, because the syntax is compatible with C shell (checked with tcsh), you would set the two variables. If you sourced the script from a Bourne-shell derivative, the exit at the end of the ksh script would cause the shell to exit; it does not seem to cause the C shell to exit. So, what you've got is a weird hybrid. Normally, you stick to one language and use it exclusively. Where you need to use another shell, you can do so, but you simply run the script written for the other shell. You can communicate to the other script with environment variables. You don't normally try writing sourceable code that ca

Categories : Shell

Google Apps Script Spreadsheets - Assign script to image from a script
This would be a cool feature, but here is a possible workaround, it might even offer more functionality. You can build a UI using Google API. More detailes here. The UI allows you to create side bars/menus/etc. You could even create floating dialog windows. Using AbsolutePanel, you can even choose where the dialogue shows up.

Categories : Google Apps Script

Looping through Images When Running HTML Script
you can likely read the file in using javascript http://www.hiteshagrawal.com/javascript/javascript-parsing-xml-in-javascript and then append to an HTML element using appendChild Javascript - Append HTML to container element without innerHTML coupled with a setTimeout based on the value of your field!

Categories : HTML

Row added by script not deleting
you have to use event delegation since you have to deal with dynamic elements, .one() supports a event delegation $(function() { $('table.listtable').one('click', '.closeseats', function() { $(this).closest('tr.seating').remove(); }); });

Categories : Jquery

Extra space added after my script
What you use is a single character hotstring (most people would use a hotkey, but this works as well. Normally a hotstring is "finished" by some pre-defined keys like {Enter} or {Space}, but you can define these "end" characters yourself. One way to no longer need the end characters is to use a few control signs in the hotstring. ::o::email address`t ; Your original, requires e.g. {Enter} or {Space} :*:o::email address`t ; Does NOT require and end character. EVERYWHERE when I write an isolated "o", I get "email address" :*?:o::email address`t ; Now the "oo" is not even isolate, but can be in a word like "more" becomes "memail addressre" The way I do this is: :*:o::email address`t ; The "" is next to my {Enter} key and when I type the combo "o" I receive "email address" More info on

Categories : Javascript

Cannot launch script on dynamically added element
use event delegation for registering handlers for dynamically added elements. Just using .on() does not make the event registration delegation based, the parameter and the element to which the handler is attached is important $(document).ready(function () { $(document).on('click', ".carousel-button-left", function () { var $ul = $(this).next().find(".carouselUl");; //alert(""+$ul.html()); var $lastchild = $ul.children().last(); $ul.prepend($lastchild); }); }); $(document).ready(function () { $(document).on("click", ".carousel-button-right", function () { var $ul = $(this).prev().find(".carouselUl"); //alert(""+$ul.html()); var $firstchild = $ul.children().first(); $ul.append($firstchild); }); }); the set o

Categories : Jquery

Is it possible to run the script when the sheet is added to google spreadsheet?
One way I've managed to do this is to define a trigger on the On Change event of the spreadsheet and call the onChange function shown below: /* CODE FOR DEMONSTRATION PURPOSES */ function onChange(e) { var _changeType = e.changeType, _ss = e.source, _newss; Logger.log(_changeType); if(_changeType === 'INSERT_GRID') { _newss = _ss.setActiveSheet(_ss.getSheets()[_ss.getActiveSheet().getIndex()]); Logger.clear(); Logger.log(_newss.getName()); } }

Categories : Google Apps Script

jQuery function is not called when script src is added to head
Your include jQuery like three times in this code. i'm not sure if thats the problem but it ain't the solution // jquery from jquery.com <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script> <!-- jQuery (required) --> // jQuery from google <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="../js/jquery.min.js"></script>')</script> // both of these are expendable this might cause a conflict since the last one to be included is an older version of the library. you only need only inclusion. I'm assuming your using migrate because you have older jQue

Categories : PHP

Google Spreadsheet Script - the value whcih added up two integer is wrong
The function toFixed can be helpful. console.log((parseFloat("5") + parseFloat("7.56")).toFixed(2)); // 12.56

Categories : Javascript

"Media undefined" when Jquery Mobile script is added to the header
Alright, although there is no direct solution, somehow I got the inspiration from here: jQuery Mobile & PhoneGap deviceReady() not fired My Jquery mobile + Phonegap audio player works well after the following modifications: 1) Load cordova.js first 2) Followed by jquery mobile.css, jquery.js and jquery mobile.js 3) The main problem is, which I think is, I mixed cordova firing process together with audio player's functions. When I separated cordova firing process as a standalone block script and audio player functions as another block of script, it works brilliantly. Below is my code for reference: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Media Example</title>

Categories : Jquery

php email script not working correctly
Mail function has errors turned off @mail($email_to, $email_subject, $email_message, $headers); remove @ from this and add simple if if(mail($email_to, $email_subject, $email_message, $headers)) { echo 'mail was sent'; //success message here } else { echo 'there were errors during sending mail'; //error message there } When you find out what errors occur then you can remove them. It can be problem with configuration of SMTP server. You can set some settings affecting mail() function in php.ini Read more here. Moreover, this Thank you for contacting us. We will be in touch with you very soon. message is shown always it doesn't check if something is wrong it is just shown.

Categories : Email

How to remove a previously added script file in a Zend Framework controller?
This works, but really isn't a good practice but rather for exceptional purposes. I recommend trying to not load the unwanted scripts in the first place. It is possible to remove scripts subsequently with a function like this one. /** * Removes a previously appended script file. * * @param string $src The source path of the script file. * @return boolean Returns TRUE, if the removal has been a success. */ public function removeScript($src) { $headScriptContainer = Zend_View_Helper_Placeholder_Registry::getRegistry() ->getContainer("Zend_View_Helper_HeadScript"); $iter = $headScriptContainer->getIterator(); $success = FALSE; foreach ($iter as $k => $value) { if(strpos($value->attributes["src"], $src) !== FALSE) { $iter->

Categories : PHP

adding css styles to dynamically added
elements in java script
Your approach has been to assign CSS styles to the names of JavaScript variables/objects. There's no direct connection between the two - CSS is looking for HTML elements with tags named ButtonContainer and NewButton. CSS isn't "smart" - it's not going to map the HTML generated by JavaScript to the styles. It's looking for a simple match, so you need to design the code so it has a match. To answer your question as asked, you could include a line like this... NewButton.style = "width: 20px; height: 40px; border: 1px solid #000;"; This will set styles on each generated NewButton element. Using CSS classes will give you a better overall result. Please note - there's a better approach. In general, the best approach is to create your code with classes and ids as part of the code. Incl

Categories : Javascript

Shell script cannot be executed from some directories even though its directory is added to the "PATH" variable
You should add the complete path to your bin directory, not just bin. If bin is in your $HOME, you can add $HOME/bin or ~/bin.

Categories : Linux

Can't correctly lanuch JS code on webpage - VBA script
The following code worked for me for programatically click 'Message 1'. When testing be carefull to enable script execution. Private Const URL As String = "C:/Temp/HTML/HTMLPage1.html" Sub test() Dim Browser As InternetExplorer Dim Document As HTMLDocument Set Browser = New InternetExplorer Browser.Visible = True Browser.navigate URL Do While Browser.Busy And Not Browser.readyState = READYSTATE_COMPLETE DoEvents Loop Set Document = Browser.Document Dim tds As IHTMLElementCollection Dim anchors As IHTMLElementCollection Dim tdElement As IHTMLElement Dim anchorElement As IHTMLElement Set tds = Document.getElementsByClassName("sc") For Each tdElement In tds

Categories : Javascript

How to make cmd correctly display arabic script?
Change your cmd's code page to the encoding you're outputting: chcp 1256 That 1256 is an Arabic code page for Windows If you're outputting in another encoding, just find them in the whole list of code pages and change 1256 to the identifier you want in the command. Hint: UTF-8 is 65001 Note: To show other characters than ascii, Window's cmd's current font must be changed to Lucida Console in properties. It's weird I know... Windows :) Hope this helps!

Categories : Python

Command Line PHP Script not executing correctly
use this mysql_query() instead of mysql_subquery() you should use PDO or mysqli instead of mysql. mysql is already deprecated

Categories : PHP

perl script added database insert statement stop after some time while in a loop
If you are not using $dbh as global variable then initialize $dbh with 'my'; my $dbh; Disconnect DB connection within the function; $dbh->disconnect(); To be even safer, at the end of function assign undef to $dbh variable; $dbh = undef;

Categories : Database

jenkins wouldn't execute python script correctly
If you are running Jenkins as a Windows service, by default it runs as user Local System. Did you check the box titled "Allow service to interact with desktop"?. If that does not help you may have to set the service to log on as an actual user, instead of Local System. This is a common problem with running any process with a GUI from Jenkins.

Categories : Python

Why would a script tag run correctly if embedded in HTML, but not generated by aspx?
The script tries to create a like below: <form id="rxwikiSearch" target="_blank" action="http://www.rxwiki.com/search" method="get" accept-charset="UTF-8"> When you use a masterpage, it has a form element and contents are rendered inside it. In the content if you have that script, it tries to render another form inside master page's form, which is not allowed. I have tested with keeping a contentplaceholder at masterpage's head (which is generated by wizard) and putting the script at content page like below: <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"> <script type="text/javascript" id="rxwiki_sw_js" src="http://www.rxwiki.com/rune/search/widget?utm_medium=search_widget&utm_source=795f9976-4258-5fc8-A659-e5c31cccf791"> <

Categories : Javascript

Script's function works correctly on resize but not on document.ready
As i understand your issue, you should set attribute width and height of images and use the document ready handler: HTML for all images in .links-image DIVs: {width/height/alt attributes should always be specified for image when possible} <div class="links-image" style="margin-top: 53px;"> <img src="img/list.png" width="210" height="92" alt=""> </div> JS code: $(document).ready(function() { $(window).resize(resetHeight).trigger('resize'); });

Categories : Javascript

in this java script animation second time animating is not work correctly
http://jsfiddle.net/WPjvF/1/ You're reverse function leaves index at -1. $("#home").click(function () { if ( index < 0 ) index = 0; cur = 1; doWork(function (el) { el.addClass("animated"); }); });

Categories : Javascript

Invoke python script from another python script and set execution directory of the executed script
You could use cwd parameter, to run scriptB in its directory: import os from subprocess import check_call check_call([scriptB], cwd=os.path.dirname(scriptB))

Categories : Python

Action Script 3. Make character jumping correctly and add collision with objects
I've learned a lot in this tutorial: Creation of a platform game with flash edit: Create colision points on the hero (make then transparent). Check colision with floor/wall. If left/right colided, stop going left/right. If colided bottom, stop falling.

Categories : Actionscript

how to pass variable from python to shell script when shell script is getting called inside python script
You can: Step through the list, and then call mail.sh once for each file. This is the most reliable way. Convert the items in the list to a space delimited string, and then pass it in to mail.sh (assuming mail.sh is setup correctly, it should accept multiple arguments). What you cannot do is pass ['a.txt','b.txt','c.txt'] wholesale to the script.

Categories : Python

Chrome Extensions: Pass data from popup to another script file before the script is injected
There are several ways to accomplish this. One would be: function click(e) { var elementIDs = { email: document.getElementById("emailID").value, company: document.getElementById("nameID").value }; chrome.tabs.executeScript({ code: 'window.elementIDs='+JSON.stringify(elementIDs) }, function() { chrome.tabs.executeScript({file: "ScriptA.js"}); }); window.close(); } This way, ScriptA will be able to access the values in window.elementIDs. This will work because content scripts from the same extension on the same page will share the execution environment, and the chaining of the calls to chrome.tabs.executeScript ensures that the script defining the global variable has run before ScriptA is run.

Categories : Javascript

how to create a script from a perl script which will use bash features to copy a directory structure
First, I see that you want to make a copy-script - because if you only need to copy files, you can use: system("cp -r /sourcepath /targetpath"); Second, if you need to copy subfolders, you can use -r switch, can't you?

Categories : Perl

Chrome extension: can't get message passing to work between background script and content script
From onMessage documentation. This function becomes invalid when the event listener returns, unless you return true from the event listener to indicate you wish to send a response asynchronously (this will keep the message channel open to the other end until sendResponse is called). So your code should look like chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { console.log(sender.tab ? "from a content script:" + sender.tab.url : "from the extension"); if (request.greeting == "hello") { sendResponse({farewell: "goodbye"}); return true; } });

Categories : Javascript

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

Code First Migrations - Update-database -script command generated SQL script not working
The -Verbose output just shows a summary of statements. If you run your command manually in SQL Server Management Studio then you need a GO between the two statements: ALTER TABLE [dbo].[Posts] ADD [Abstract] [nvarchar](max) GO UPDATE dbo.Posts SET Abstract = LEFT(Content, 100) WHERE Abstract IS NULL The quick fix is to do something like: update-database -script then use Sql Server management Studio to do the following search and replace in the generated script: find what: ^{:b*}{{INSERT|UPDATE|SELECT|DELETE}.+} (this finds any CRUD statements) replace with: 1GO 12 (keep the indents, and add GO before any CRUD statements) Find options: Use regular expressions But, note that -Verbose doesn't give you the output you want, you need the output from -Script, or you will be missing the

Categories : Entity Framework

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

In Embedded Octave C++ how do I execute a script file? ("error: invalid call to script")
You should be using the function source_file() rather than eval_string(). Take a look into the parser.h file which unfortunately doesn't have a lot of comments. The names are quite self-explanatory so you shouldn't have a lot of problems. Also, you're pretty much trying to reimplement Octave's source function. If you really want to implement it again, look into the oct-parse.cc file (generated during the build process with flex and bison).

Categories : C++

Run a line of script via a variable based on a value inside the worksheet - google apps script
One option may be to use eval(), but remember you have to be careful with this function. ... var doThat = ss.getRange("A1").getValue(); eval(doThat); ...

Categories : Google Apps Script

Piping Perl script output to head -n 10 kills script after printing 10 lines
When the reading end of a pipe is closed, and the writing process tries to write something to a pipe, then the writing process receives a SIGPIPE. The pipe is called broken. We can capture this event like local $SIG{PIPE} = sub { # This is our event handler. warn "Broken pipe, will exit "; exit 1; }; This would gracefully exit your program. Instead of installing a sub as event handler, you could give the string IGNORE. This would let your script carry on as if nothing happened. # print will now return false with $!{EPIPE} true instead of dying local $SIG{PIPE} = 'IGNORE';

Categories : Linux



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