How do I include newlines in labels in D3 charts?

I’m using D3 to generate a bar chart (I adapted the code from this example). The labels I’m using on the x-axis are a couple of words long each, and since this makes all of the labels overlap I need to break these labels across lines. (It’ll be fine if I can replace all of […]

ng-model not working for radio button in AngularJS

I am new to Angular and I am trying to obtain the value of the radio button that the user has selected using ng-model. But I am not getting any output in “selected contact”. Here is My HTML <!doctype html> <html ng-app> <head> <script src=””></script> <script src=”script.js”></script> </head> <body> <form name=”myForm” ng-controller=”Ctrl”> <table border=”0″> <th>Contact […]

What is the difference between semicolons in JavaScript and in Python?

Python and JavaScript both allow developers to use or to omit semicolons. However, I’ve often seen it suggested (in books and blogs) that I should not use semicolons in Python, while I should always use them in JavaScript. Is there a technical difference between how the languages use semicolons or is this just a cultural […]

How can Gulp be restarted upon each Gulpfile change?

I am developing a Gulpfile. Can it be made to restart as soon as it changes? I am developing it in CoffeeScript. Can Gulp watch in order to restart when changes are saved?

Is strict mode more performant?

Does executing javascript within a browser in ‘strict mode’ make it more performant, in general? Do any of the major browsers do additional optimisation or use any other techniques that will improve performance in strict mode? To rephrase slightly, is strict mode intended, amongst its other goals, to allow browsers to introduce additional optimisations or […]

How to disable an input type=text?

I want to disable writing in an input field of type text using JavaScript, if possible. The input field is populated from a database; that is why I don’t want the user to modify its value.

what is the difference between ?:, ?! and ?= in regex?

I searched for the meaning of these expressions but couldn’t understand the exact differnce between them. This is what they say: ?: Match expression but do not capture it. ?= Match a suffix but exclude it from capture. ?! Match if suffix is absent. I tried using these in simple RegEx and got similar results […]

Double negation (!!) in javascript – what is the purpose?

Possible Duplicate: What is the !! (not not) operator in JavaScript? I have encountered this piece of code function printStackTrace(options) { options = options || {guess: true}; var ex = options.e || null, guess = !!options.guess; var p = new printStackTrace.implementation(), result =; return (guess) ? p.guessAnonymousFunctions(result) : result; } And couldn’t help to […]

jquery smooth scroll to an anchor?

Is there a way to scroll down to an anchor link using jQuery? Like: $(document).ready(function(){ $(“#gotomyanchor”).click(function(){ $.scrollSmoothTo($(“#myanchor”)); }); }); ?

non-AJAX jquery POST request

i am trying to use the jquery POST function but it is handling the request in AJAX style. i mean its not actually going to the page I am telling it to go. $(“#see_comments”).click(function() { $.post( “comments.php”, {aid: imgnum}, function(data){ }); }); this function should go to comments.php page with the aid value in hand. […]