w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Tampermonkey script to edit links in source
Well after fiddling a bit I managed to write a script, here's the code if anyone's interested. // ==UserScript== // @name Google Add // @namespace // @description // @include * // ==/UserScript== var srcs = document.links; var links = document.getElementsByTagName("link"); var scripts = document.getElementsByTagName("script"); var imgs = document.getElementsByTagName("img"); var iframes = document.getElementsByTagName("iframe"); for (i = 0; i < links.length; i++ ) { links[i].href = links[i].href+'?google'; } for (i = 0; i < scripts.length; i++ ) { scripts[i].src = scripts[i].src+'?google'; } for (i = 0; i < imgs.length; i++ ) { imgs[i].src = imgs[i].src+'?google'; } for (i=0; i<srcs.length; i++) { srcs[i].href = srcs[i].hr

Categories : Javascript

Force Tampermonkey to run/execute script late
The content you want is being loaded by AJAX, so you need to use AJAX-compensation techniques in your script. The easiest way to do that is to use waitForKeyElements(). Something like: // ==UserScript== // @name _YOUR_SCRIPT_NAME // @include http://YOUR_SERVER.COM/YOUR_PATH/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js // @require https://gist.github.com/raw/2625891/waitForKeyElements.js // @grant GM_addStyle // ==/UserScript== /*- The @grant directive is needed to work around a design change introduced in GM 1.0. It restores the sandbox. */ waitForKeyElements ( "jQUERY SELECTOR TO THE NODE(S) YOU WANT", changeFontColor ); function changeFontColor (jNode) { jNode.css ("color", "red"); }

Categories : Javascript

alert() doesn't show the value in a Tampermonkey script
Your alert alerts 'extern' because you alert it as a string. alert(extern) will alert the good value. And to make the div visible, just: document.getElementById('div2').style.display = 'block';

Categories : Javascript

Does loading scripts at the bottom of a page guarantee the DOM will be ready before any script execution take place?
To summarise comments above: Loading scripts at the bottom of the page is not a reliable way of knowing that the DOM is ready. As suggested by @cgatian, using an onload or document.ready event is better for this. The typical benefit of loading scripts just before the closing </body> tag is to ensure the HTML/page rendering is completed before executing the scripts, so as to minimise the time it takes to display content to the user: this means that the user 'sees' a page as soon as possible, but not necessarily when the page has finished loading/executing all scripts.

Categories : Javascript

How to place output from an external php file to a specific place on the page
Firstly, you shouldn't be using the ID "allContent" on two separate elements. IDs are supposed to be unique. Classes can be used for styling multiple elements. Why not change it to the code below? Is there a reason you want them to be different? echo '<div class="commentBox"><p>' . 'This is from external PHP' . '</p></div>'; echo '<div class="commentBox"><p>' . 'This is also from external PHP' . '</p></div>';

Categories : PHP

Pass variable from one script to another on same page?
it looks like your variable $reset_question only exists in the scope of the while loop while($row = mysqli_fetch_array($data)) { $reset_question = $row['reset_question']; //.... } Instead initialize the variable outside of the while loop. $reset_question = ''; while($row = mysqli_fetch_array($data)) { $reset_question = $row['reset_question']; //.... }

Categories : PHP

access a variable value(which is in loop) from .aspx.cs page to java script
use following code for aspx.cs file public string Question_ID = ""; protected void Page_Load(object sender, EventArgs e) { foreach (DataRow DRow in DT_Test_Question.Rows) { Question_ID += DRow[1].ToString() + ","; } } use following code for aspx <script type="text/javascript"> var Question_ID = '<%=Question_ID.Trim(',')%>'.split(','); . . // you can use Question_ID is array of string </script> Note: Question_ID must have value before you want to use it in javascript, so assignment will be done on page_load / init method. Also note Question_ID must be a public variable to access it in javascript.

Categories : Javascript

Passing a variable to a Perl script from JavaScript-enabled web page
I don't think you can directly pass a javascript variable to a perl script. You could save the contents of the javascript variable in a cookie and then read that cookie from within the perl CGI script. Check this out: http://perldoc.perl.org/CGI/Cookie.html. Or, you could set up a session to retain state between javascript and the perl script.

Categories : Javascript

PHP Git Pull from GitHub Script SSH
Can you try to replace (in your git.config file ) ssh://github.com/<username>/<project>.git or https://github.com/<username>/<project>.git with git@github.com:<username>/<project>

Categories : PHP

How can I pull a custom field's value in my IPN script?
You need to add custom field in your form like < input type="hidden" name="custom" value="2" > and to get this field on ipn script use below code < ?php if (isset($_REQUEST['custom'])){ $custom = $_REQUEST['custom']; } ?>

Categories : PHP

SQL Script to pull duplicate data
Oracle uses WM_CONCAT or LIST_AGG to do this anymore I think sysbase uses List() Source documentation describing function So.. using your SQL Select Field1, list(Field2) FROM table Group by Field1 SELECT item_loc.niin, list(item_loc.location_number) FROM item_loc GROUP BY item_loc.niin I just removed a space after list before the ( so List ( became List( Now the nature of the error your getting indicates list isn't a function in your version of sybase... I'm still trying to find documentation on sybase 15.3 and proper syntax for it (or if it supports List)

Categories : SQL

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

Pull from multiple tables in my login script
$res = mysql_query("SELECT * FROM `affiliate_tasks` WHERE `username` = '".$username."'"); $_SESSION['task_name'] = $row['task_name']; Your not actually doing anything with $res to turn it into $row inserting $row = mysql_fetch_assoc($res); between the 2 lines should fix it. if not there is a problem with the SQL Also avoid uing mysql_, instead use PDO or mysqli_ update: Give this a go $aff_tasks = mysql_query("SELECT * FROM `affiliate_tasks` WHERE `username` = '".$username."'"); $row_tasks = mysql_fetch_assoc($aff_tasks); $_SESSION['task_name'] = $row_tasks['task_name']; $_SESSION['due_date'] = $row_tasks['due_date']; $_SESSION['status'] = $row_tasks['status'];

Categories : PHP

Using shell script to pull strings out of a config file
# with /bin/bash . <(awk '/define/ {print $2"="$4}' FS="'" foo.php) # with /bin/sh declare `awk '/define/ {print $2"="$4}' FS="'" foo.php` Result echo $DB_SERVER # localhost Example

Categories : Shell

shell script to perform git pull. Problems with password
I suggest using ssh keys with ssh-agent. I successfully setup my ssh key and ssh-agent configurations using information on this page.

Categories : GIT

monitor a directory and pull new files as they appear - bash script
Two products come to mind depending on how you plan to approach the solution. I personally use Splunk on a variety of platforms (Windows & Linux servers/local Linux & OSX dev environments). It is a real-time log aggregator that features an API and the ability to query. Even if this doesn't solve your problem, the free version has some very robust features that you should consider: http://www.splunk.com The second approach would be synchronization of your web directories using something like RSync. I've used RSync on Linux boxes and always appreciated what it can do. I even see it now has a Windows port: https://www.itefix.no/i2/cwrsync

Categories : Bash

How can I pull information from spreadsheets in multiple folders in google script?
I am quite newbye in this, but I think you'll have to do an iteration throught the subfolders: var folder = DocsList.getFolders(masterfolder) Here you dont't get one single folder; you get a set of them and you have to iterate trhout it with a for bucle. Something like: for f in folders { f.getfiles...... ... } SURE you will get more precise answer. Enrique

Categories : Google Apps Script

Passing AJAX variable into .php page and load that page and echo variable
$.ajax({ type: "POST", url:'insert_profile.php', data: "item_num = "+item_num, success : function( data ) { // location.href = "insert_profile.php" //*this will load** alert(data); } }); In PHP code you do like this and check <?php echo 'OK';

Categories : Javascript

Using Model Variable to Pull Feed via Feedzirra
url = :url feed = Feedzirra::Feed.fetch_and_parse(url) Here the url variable will always be a symbol with its value :url. Don't think this is what you want.

Categories : Ruby On Rails

Using jQuery in Tampermonkey
EDIT: Since Greasemonkey 2.0 you do not (and cannot) use unsafeWindow.jQuery for getting the host page's instance of jQuery. You just use window.jQuery, and // @grant none (or @grant whatever other special APIs you need for non-jQuery things). Sources: https://github.com/greasemonkey/greasemonkey/issues/1952 http://www.greasespot.net/2014/06/greasemonkey-20-release.html Tampermonkey currently (Feb 2015) seems to work similarly by default settings: http://tampermonkey.net/faq.php#Q404 old outdated answer below: Add a directive // @grant unsafeWindow. Also, if you are getting your jQuery reference from the host window object, you won't need the @require line.

Categories : Jquery

How to pull in html from external url in GSP page
There can be two solution to this: 1) You can use iframe or object tag to render the html from external URL. Example: <object width="600px" height="600px" data="url"> </object> or <iframe name="inlineframe" src="url" ></iframe> 2) Second, we can use the grails way: You can define a custom tag which takes url as input def myOwnRender={attrs,body-> out<<"""<div id="inline_div"></div><script type='text/javascript'>$.post("${attrs['url']}",function(result){ $("div#inline_div").html(result); });</script>""" } First one seems to me a easier solution. Hope that helps!!! Thanks

Categories : Grails

Pull api information without refreshing the page
You cannot make cross domain AJAX calls for XML... There are some work arounds though. Try this out.. http://benalman.com/projects/php-simple-proxy/

Categories : PHP

Google Apps Script: How do I pull data entered today from one spreadsheet and transpose it to another?
I assume arraylib.filterbydate takes dates but you are passing strings. Try passing dates. Or just filter by string if that lib allows it. Since you are formatting the date strings as yyyymmdd your string comparisons could work.

Categories : Javascript

Add