w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Ubuntu in Virtualbox cannot connect to github, port closed?
In that case, it sounds like a firewall is blocking the git protocol — you may be able to solve the issue by ensuring that port 9418 is also open. The suggested solution from the linked article is to use HTTP or SSH instead; a recent SO answer notes that SSH and GIT are now very similar in terms of performance.

Categories : Ubuntu

Dynamically calculate table heading widths using javascript - how to? (PHP -> javascript variable assignment)
<script type="text/javascript"> var columnno = <?php echo $numberofcolumns; ?>; var headingWidth = Math.floor(80 / columnno); var lastHeadingWidth = 80 - headingWidth; // now you assign these values to your columns. I'd suggest you use jQuery, assign a class to each column (col1, col2, etc., using PHP), and then: // we assume i = 1 is that 20% fixed column for(i = 2; i < columnno; i++) { $('.col' + i).css('width', headingWidth + '%'); } $('.col' + columnno).css('width', lastHeadingWidth + '%'); </script> Why Math.floor and lastHeadingWidth? If you divide 80 by 3 and then multiply the result by 3 you'll find out you are missing 0.0000000000001 pixels (it's all about internal number representation and precision). Also, some browsers automatically round float valu

Categories : PHP

List all public gitHub repositories as links
Warning: GitHub hosts a huge number of repositories. You'll have to take this into account when designing your index. I can think of a few options: The legacy GitHub search API. You'll have to cope with the API rate limit though. This StackOverflow answer could be a good start to get a rough grasp of the number of repos per language. Leveraging the GitHub Archive project which records the public GitHub timeline. (Note: As the project only exposes events back from February 12, 2011, you won't get any data about repositories showing no activity since this date.)

Categories : Github

Images in github pages and relative links
try this <img src="images/emoticons/cool.png" alt="hi" class="inline"/> Full Page <!DOCTYPE html> <html> <head> <meta charset='utf-8' /> <meta http-equiv="X-UA-Compatible" content="chrome=1" /> <meta name="description" content="Home Page : My Github Web" /> <link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css"> <title>Home Page</title> </head> <body> <!-- HEADER --> <div id="header_wrap" class="outer"> <header class="inner"> <a id="forkme_banner" href="https://github.com/Avi-Aryan">View on GitHub</a> <h1 id="project_title">Home Page</h1> <h2 id="project_tag

Categories : HTML

Want to remove the highlighted heading when the current heading id clicked
Here is how you could do it: fiddle example .js $("h2").on("click",function(){ $(this).addClass("red"); $("h2").not(this).removeClass("red"); }); .css .red{ background: red; } .html <h2>header</h2> <h2>header</h2> <h2>header</h2> <h2>header</h2> <h2>header</h2>

Categories : Jquery

how to make the background of the heading the same length as the heading?
Use floats: See the fiddle: http://jsfiddle.net/Zb6KV/4/ .custom-section-head { background: red; float:left; } h3 { float:left; } Then the h3 and the container will be the size of the heading. However, why not just add the background the head <h3> element?

Categories : HTML

Check a web form is closed / refreshed in javascript
The function work fine IE but not in other browsers. That's absolutely normal. Other browsers simply do not allow you to be alerting in this function. Check that fiddle out in Chrome: Sorry, you should forget about alerting in an onbeforeunload handler. The only thing you should be doing in this handler is returning a string result: window.onbeforeunload = function (e) { var y = window.event.clientY;// e.pageY || e.clientY; if (y < 0) { return 'Window closed'; } else { return 'Window refreshed'; } }; It's the responsibility of the browser to decide how to display this information to the user, not you by telling it to explicitly alert.

Categories : C#

Trying to toggle a drawer open and closed with javascript
Try event delegation, since you are working with dynamic selector values $(document).on('click', '.arrow-up', function() { $('.portfolio-details').css('height',250); $('.portfolio-details h2 span').removeClass('arrow-up'); $('.portfolio-details h2 span').addClass('arrow-down'); }); $(document).on('click', '.arrow-down', function() { $('.portfolio-details').css('height',25); $('.portfolio-details h2 span').addClass('arrow-up'); $('.portfolio-details h2 span').removeClass('arrow-down'); });

Categories : Javascript

How to use a regular expression for checking if comment is closed in javascript?
There is no way to use regular expressions for checking parenthesis. In order to check if brackets or comment (e.g. /../) are closed, you have to iterate over a string, count the number of opening brackets, and of closing brackets, and to compare. Example: function check(str) { var paranCount = 0; for (var i = 0; i < str.length; i++) { if (str[i] == '[') paranCount++; else if (str[i] == ']') paranCount--; if (paranCount < 0) return false; } return !paranCount; } Note: This only applies to code pieces that do not contain string (for example), though the inline string "asfasdf[[[" is legal inside the code, yet this function will not deem it so. With the absence of other limitations to the code, you should use a

Categories : Javascript

Finalizing a Cursor that has not been deactivated or closed or database not closed error
When you are done with the cursor, you need to call Cursor.close(). Leaving it not closed leads to memory leaks. E.g.: Cursor cursor = null; try { cursor = getContentResolver().query(myUri, MY_PROJECTION, null, null, null); if (cursor != null && cursor.moveToFirst()) { // moar code } } finally { if (cursor != null) { cursor.close(); } }

Categories : Android

A Comprehensive Regular Expression to find URL, links,page links, website links from HTML Page or String
Have a look here http://regexlib.com/Search.aspx?k=URL&AspxAutoDetectCookieSupport=1 You can find a lot of examples and patterns there and there are a lot of general Regex tutorials and articles. After a quick browse I found this : ([dw-.]+?.(a[cdefgilmnoqrstuwz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvxyz]|d[ejkmnoz]|e[ceghrst]|f[ijkmnor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eouw]|s[abcdeghijklmnortuvyz]|t[cdfghjkmnoprtvwz]|u[augkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw]|aero|arpa|biz|com|coop|edu|info|int|gov|mil|museum|name|net|org|pro)(|W(?<!&|=)(?!.s|.{3}).*?))(s|$) Should do the trick, but I'm sure there are more elegant examples on that list.

Categories : C#

Application gets closed when terminal is closed, how to stop this?
Use nohup to prevent child processes from being killed when the terminal closes. spawn nohup /usr/bin/firefox https://www.google.com/ I assume there's more to the script, since there's no need to use Expect just to start firefox.

Categories : Python

Link and execute external JavaScript file hosted on GitHub
This is no longer possible. GitHub has explicitly disabled JavaScript hotlinking, and newer versions of browsers respect that setting. https://github.com/blog/1482-

Categories : Javascript

Sort links with javascript?
You're sorting by whatever is between <li> and </li>, which includes the URLs, not just the names. So if the URLs don't sort similarly to the names, the results will be out of order. In your case, you're sorting by the ID numbers in the URLs. A simple way to solve this is to put the names in the anchor elements, e.g. <li><a data-name="Peter" href="tumblr.com/post/57781372261">Peter</a></li> <li><a data-name="Mary" href="tumblr.com/post/57783141055">Mary</a></li> <li><a data-name="Paul" href="tumblr.com/post/57781372261">Paul</a></li> Putting the data-name attribute before the href attribute should make it take precedence. Actually, I'm not totally sure this will work. The innerHTML property

Categories : Javascript

Javascript search through links
Because of same-origin policy and other challenges, this is not presently possible to do solely on the browser. However, there are server-side JavaScript projects using node.js that make this relatively straight-forward to do on a server or on your desktop (but not on your browser). Because it's nodejs, you can use the same kind of JavaScript (even jquery selectors) as you would in the browser. One nice example is node.io, although it's primarily built for use on Linux or OSX: https://github.com/chriso/node.io For a more WIndows-friendly approach, you could use nodejs along with Request (https://github.com/mikeal/request) and Cheerio, or else jsdom. There are a number of tutorials out there that use this approach (the first tutorial even extracts a list of URLs from a page): http://

Categories : Javascript

Handling links in JavaScript
Use the window.open method, and set the name argument to _blank to open links in a new tab. e.g. window.open("http://google.com", "_blank") See here If you just want to store the links in JavaScript and then open them all when a user clicks on a button, why not do something like this: function addListener(element, eventName, handler) { if (element.addEventListener) { element.addEventListener(eventName, handler, false); } else if (element.attachEvent) { element.attachEvent('on' + eventName, handler); } else { element['on' + eventName] = handler; } } var links = ["http://google.com", "http://yahoo.com"]; var open_trigger = document.getElementById('open-all'); addListener(open_trigger, "click", function() { for(var i = 0; i < links.length; i ++) { win

Categories : Javascript

Github, Github for Windows, on every commit generates us.stackdump
This is similar to the msysgit issue (in progress) 25, with one only suggestion for now: replace msys-1.0.dll by a new one in "documents and settingsadministratorlocal settingapplication datagithubportablegit_xxxx..." Try first to commit with the msysgit included in GitHub for Windows, and see if the issue persists. Launch a session through C:UsersYourUsernameAppDataLocalGitHubPortableGit_93...git-cmd.bat Or through the icon "Git Shell", which launches: C:UsersYourUsernameAppDataLocalGitHubGitHub.appref-ms --open-shell

Categories : Github

Does it make a difference to use the GitHub app when integrating Xcode with GitHub?
You can still have conflicts. If somebody makes a change to the project file and you make a change to the project file and you try to commit it at the same time as (or soon after) the other person, there's a good chance you'll see conflicts. Thankfully, the "project.pbxproj" project file is text which can you can open with your favorite editor (vi or emacs or whatever) and you can resolve the conflicts rather easily.

Categories : Xcode

How do I add links to this javascript image rotator?
UPDATED ANSWER: Please use this code instead. I've re-written my original answer, because there were a few problems with it. Replace the entire Dreamweaver inserted code with this: function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i]; } } } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&

Categories : Javascript

Get value of HREF for links within a certain Class in Javascript
Use Element.attributes instead of Element.innerHTML. With your HTML you also need to use an inner loop to get <a> children of .r elements: var domains = document.getElementsByClassName('r'); for(var i = 0; i < domains.length; i++){ var anchors = domains.getElementsByTagName('a'); for (var j = 0; j < anchors.length; j++) { alert(anchors[j].attributes.href); } } or you could switch to Element.querySelectorAll() for a nicer querying API: var anchors = document.querySelectorAll('.r > a'); for (var i = 0; i < anchors.length; i++) { alert(anchors[i].attributes.href); } Note that I reused the domains variable since there's no reason to keep re-querying the DOM at every loop iteration.

Categories : Javascript

Can javascript pick up inbound links
You can use document referrer for this. document.referrer https://developer.mozilla.org/en-US/docs/Web/API/document.referrer

Categories : Javascript

Opening links in other windows with Javascript
I have no idea what the "ribbon screen" is but your code has a lot of problems. First, being if you are using document.write() in <header> the outcome is not going to be visible and it's overall bad practice. Second problem is this is completely wrong document.write("<p>",txt,"</p><br />"); the correct code would be document.write("<p>"+txt+"</p><br />"); Third, is you can write this whole thing as just one short line: <button type="button" onclick="window.open("test.html")">Run code</button> Hope this helps, Cheers

Categories : Javascript

JavaScript all links on a page with regex
Newer browsers: var links = document.querySelectorAll('a[href^="/item/"]'); Older browsers: var links = []; var elements = document.getElementsByTagName('a'); for (var i = 0; i < elements.length; i++) { var a = elements[i]; if (a.getAttribute('href').indexOf('/item/') === 0) { links.push(a); } }

Categories : Javascript

Alert does not appear for links inserted by JavaScript
Use on with delegation so that the new elements also can receive the event : $(document.body).on('click',"a",function(event){ alert("Hello!"); });

Categories : Javascript

How to Force Click on All "Like" Links on Facebook.com via JavaScript?
var s = document.createElement("script"); s.src = "http://code.jquery.com/jquery-latest.min.js"; s.type = "text/javascript"; document.getElementsByTagName("body")[0].appendChild(s) console.log($) s.onreadystatechange = function() {console.log($)}; s.onload = function() { console.log($)}; Notice that the console.log($) throws an undefined, I think jQuery was not loaded at the time you added invoke the $().click(). So you wait for the Script to load and be ready. s.onreadystatechange = function() {console.log($)}; s.onload = function() { console.log($)};

Categories : Javascript

How can I add links to my custom javascript image swap?
You have to call it on the links: function slideSwitch() { var $active = $('#slideshow a.active'); if ( $active.length == 0 ) $active = $('#slideshow a:last'); // use this to pull the images in the order they appear in the markup var $next = $active.next().length ? $active.next() : $('#slideshow a:first'); $active.addClass('last-active'); $next.css({opacity: 0.0}) .addClass('active') .animate({opacity: 1.0}, 1000, function() { $active.removeClass('active last-active'); }); }

Categories : Javascript

Javascript show/hide links not working
First of all, your link is incomplete: <a href="dining.gmu.edu">dining.gmu.edu</a> So this should be something like: <a href="https://gmu.sodexomyway.com/home.xhtml">dining.gmu.edu</a> Also, since you have jQuery already running on the page, you might want to simplify your code to: $("#Ikes").click(function() { $(".objects").hide(); $(this).show(); }); Where Ikes is the id of the clickable img and .objects is the class of all the clickable images. Also, I saw that it is not possible to click Ikes in FireFox. So you might want to look into that as well. UPDATE What seems to be causing the problem is your layout: you use position:relative; and position:absolute; throughout whereas this is quite dangerous when 'spawning' divs. For example: #svg {

Categories : Javascript

Tracking outbound links using ajax (javascript)
With jquery: $('a').click(function(e) { //check that it is offsite if($(this).attr("href").indexOf("http")==1) { //prevent the redirect; e.preventDefault(); //do your tracking $.ajax{ url: 'yourtracking.php', data: "link=" + $(this).attr("href"), complete: function(){ //now do the redirect window.location = $(this).attr("href"); } } } });

Categories : PHP

onclick event not working with the links in javascript
You have 2 problems: 1) You have a syntax error in your for loop. You need to use semicolons instead of commas for (var i = 0, i < elements.length; i++) { vs for (var i = 0; i < elements.length; i++) { 2) The onclick callback is referencing i. The problem is, that you are changing i during your loop, but you only make the onclick callback later, after your loop completes. Hence the value of i is actually going to be 1. And that means i will be the same value for every single link you click. So, if you had 5 links, i will be 6 for all of them (6 being the first breaking-value of your for loop) The important thing to remember here is onclick is called later, and you're updating i before then. To get around this problem, you can capture the value of i at the time you defin

Categories : Javascript

Creating Clickable Links in Twitter API 1.1 Javascript
Here is the solution: function replaceAtMentionsWithLinks(text) { var exp = /@([a-zd_]+)/ig; return text.replace(exp, "<a href='http://twitter.com/$1' <http://twitter.com/%241%27> @$1</a>"); } function replaceURLWithHTMLLinks(text) { var exp = /((www.|http://)S+)/ig; return text.replace(exp,"<a href='$1'>$1</a>"); } function replacehashtags(text) { var exp = /#(w+)/ig; return text.replace(exp, "<a target='_blank' href='https://twitter.com/search?q=%23$1&src=hash'>#$1</a>"); }

Categories : Javascript

Filter the output images links with javascript
If i understand you right , you need simply this: toInject += "<li class='"+classname+"'><a href='#'><img src='" + img_src.split(".").join("-150x150.") + "' width='75' height='75' alt='' /></a></li>"; Update after question edit: Is it possible for you to add a full path in the end like this: toInject += "<li class='"+classname+"'><a href='#'><img src='http://127.0.0.1/wordpress/" + img_src.split(".").join("-150x150.") + "' width='75' height='75' alt='' /></a></li>"; or you got your pp_images array already with full paths?

Categories : Javascript

Javascript multi-level drop down with links
Try adding this to your code: var links = [['http://www.eleven.com', 'http://www.twelve.com'], ['http://www.twentyone.com', 'http://www.twentytwo.com']] $b.delegate('option', 'click', function() { var a = $a.children('option:selected').data('sel'); var b = $(this).data('sel'); document.location.href = links[a][b]; }); Note that I used delegate() because the Fiddle you linked uses an older version of jQuery that does not have the on() method; with jQuery 1.7+, you can use $b.on('click', 'option', function() { instead: http://jsfiddle.net/4Zw3M/1022/. And I suspect there's a more elegant way of doing things than the JavaScript shown in the fiddle, but I unfortunately don't have the time to investigate that at the moment.

Categories : Javascript

JavaScript toggle 2 links from full page
Looks like you can simply manage that by adding a CSS class to the elements that were already "selected". Check this simple test I did at JSFiddle: http://jsfiddle.net/L4rUM/1/ // When you click the "?" $('button#btnHelp').on('click', function(){ // Gathers the list of ALL <a> elements that were not "selected" yet var uncheckeds = $('.main .container > a:not(.selected)'); // If you have at least 2 available elements if(uncheckeds.size() > 1){ // Adds the .selected CSS class to first 2 non-selected elements uncheckeds.eq(0).addClass('selected'); uncheckeds.eq(1).addClass('selected'); } }); And the CSS manipulation you are doing is now controlled by just adding the CSS class: .selected { color: #0c0; } I hope this help

Categories : Javascript

How to extract a list of links from a page in Javascript
Using chrome you could use something like: var list=document.getElementsByClassName('yt-uix-contextlink'); for (i=0;i<list.length;i++) { console.log(list[i].getAttribute("href")); } Paste it in the console tab. This will actually produce 2 links (/watch...) for each video.

Categories : Regex

github for windows, cloned repos don't put in github tab
According to github support, "Currently the 'github' tab only shows repositories that are under your account or under an organization that you belong to." Maybe requested feature will be added later

Categories : Misc

Javascript: want 2 different text links to display 2 different divs (in the same place)
Maybe something like the following? http://jsfiddle.net/vhzAR/ HTML: <a href="#" id="music_toggle">music</a> <a href="#" id="contact_toggle">contact</a> <div id="music" style="display:none;"> music stuff </div> <div id="contact"> contact stuff </div> JavaScript: function toggle_visibility(enable, disable) { var e = document.getElementById(enable); e.style.display = 'block'; e = document.getElementById(disable); e.style.display = 'none'; } document.getElementById('music_toggle').onclick = function() { toggle_visibility('music', 'contact'); }; document.getElementById('contact_toggle').onclick = function() { toggle_visibility('contact', 'music'); };

Categories : Javascript

regex not detecting youtube links in javascript contenteditable div
No links are processed since you exclude anchors (<a> tags) from the recursive call in this line: else if (n.nodeType === 1 && !/^(a|button|textarea)$/i.test(n.tagName)) You should allow them by changing the regular expression to /^(button|textarea)$/i or use some other condition that will ensure that links (or their href property) are processed. For example, if you encounter a link, you can test its href property against the urlYoutube regEx. See this jsFiddle for more details.

Categories : Javascript

How to get javascript for sorting lists with links working in all browsers?
The problem you have in Firefox is probably due to the fact that the Document Object Model (DOM) is not ready and available when the JavaScript is executed. Different browsers handle things differently and when scripts are executed are one of those things. What you need to do is to: Wrap your code in a function Execute that function when the page (DOM) is ready You can use this to detect when the page is loaded: var readyStateCheckInterval = setInterval(function() { if (document.readyState === "complete") { init(); // This is the function that would contain your code. clearInterval(readyStateCheckInterval); } }, 10);

Categories : Javascript

How to make links in a Javascript "slide out" menu work
You can do this without javascript only need to add css like this li a:hover { padding-left: 10px; } With jquery You have to add this <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script type='text/javascript'> $("li a").hover(function() { $(this).stop().animate({paddingLeft : "10px"},200); },function() { $(this).stop().animate({paddingLeft : "0px"},200); }); </script> DEMO

Categories : Jquery

How to draw closed spline 3D (closed curve 3d) through unordered list of points3D. How to arrange points3D?
It sounds like you're looking for the Concave Hull of the data set. Unfortunately, I don't know of any pre-canned algorithms, but the link references a paper that another developer was starting from, as well as some sample code, so maybe that'll help you in the right direction.

Categories : C#



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