JavaScript

#slider
#adsense

JavaScript - Yahoo News Search Results

119.88 ¥/$ (5 p.m.)

Sorry, but your browser needs Javascript to use this site. Pro-Russian fighters patrol Tuesday in in the village of Shirokine near the strategic port of Mariupol, Ukraine.

Popular JavaScript Package Manager Npm Raises $8M, Launches Private Modules

 Most JavaScript developers are familiar with the npm package manager, which was originally developed by Isaac Schlueter. What many probably don’t know is that npm is also a company co-founded by Schlueter to support the project. Today, npm announced that it has raised $8 million on top of the $2.6 million seed round led by True Ventures the company announced last February. The lead… Read More

120.13 ¥/$ (9 a.m.)

Sorry, but your browser needs Javascript to use this site. Four out of 7 patients, including foreign visitors, who had liver transplants died within one month after the surgery at a new hospital in Kobe established in November, the Yomiuri Shimbun said Tuesday.

SCENE AROUND Special Populations Prom, April 11

Javascript is Disabled! This slideshow viewer requires javascript. To view this slideshow either enable javascript and refresh the page or go to http://www.reflector.com/slideshow_basic/2843101/1

Cool tools for compiling to JavaScript

Every programmer has a favorite language or two. JavaScript lovers are the luckiest these days because their language is taking over the Internet and the Internet is taking over the world. Those whose hearts reside elsewhere in the programming language world, however, are stuck. They can either stay on the sidelines and curse the relentless juggernaut of HTML, CSS, JavaScript, and Node.js, or ...

Google refocuses Dart as a JavaScript helper

Backing down on ambitions to create a commercial grade Web programming language, Google is shifting work on its Dart programming language to make it an optimization aid for the pervasively popular JavaScript, which Dart was originally designed to supplant. The company no longer plans to incorporate Dart into its Chrome browser, the two creators behind Dart announced in a blog item posted ...

Instant feedback arrives for JavaScript code testing

Developers looking for quick results when testing JavaScript code could have a solution with the Wallaby.js test runner tool, a code coverage technology intended to offer nearly immediate reporting of results.

Delicious/tag/JavaScript

recent bookmarks tagged JavaScript

Javascript Replace All Hashtags w/ Links

Posted on 3 April 2015

Programmer: ASP.NET AJAX: Calling PageMethods Synchronously

Posted on 3 April 2015

Creating a downloadable text-file using blobs - JSFiddle

Posted on 3 April 2015

www.tutorialsavvy.com

Posted on 3 April 2015

Draft Countdown

Posted on 3 April 2015

jQuery.scrolling

Posted on 3 April 2015

www.tutorialsavvy.com

Posted on 2 April 2015

blog.servo.org

Posted on 2 April 2015

spmbt.github.io

Posted on 2 April 2015

github.com

Posted on 2 April 2015

Top Answers About JavaScript (programming language) on Quora

Top Answers About JavaScript (programming language) on Quora

Having built web stuff the old way (PHP/MySQL) back in the day and wanting to build a new account based web site / app that can handle scaling. What's the best tech / approach these days?


I am guessing (and feel free to correct me if I am wrong), that one of the attractions of PHP in the first place was that it allowed you to start with static HTML which then became progressively more dynamic as you built out the server parts of your application. We can describe this architectural style as server-side templating.

These days you are more likely to use a framework like Angular JS to build a purely client-side UI and then connect that UI to a backend that exposes REST-based microservices to that UI. This provides a cleaner separation of concerns between the two layers than server-side templating does.

The idea of microservices is to decompose your application at boundaries that can be scaled independently of other components of your application.  You might start out will all services running in the same container on one host but then split out the microservices into separate containers as your scaling needs grow. If you have identified the right service boundaries and services interfaces upfront, this will be a relatively painless process.

Microservices are also an architectural style that takes best advantage of cloud-based computing services. A traditional application server based approach (think: IBM WebSphere or Web Logic) is too heavy weight,  cumbersome and (because of licensing costs) expensive to be easily deployed in cloud infrastructure.

Microservices are cheaper to deploy into clouds because they tend to be deployed with exactly those libraries that are actually needed to execute the service and no more.  As a result, it is much easier to achieve higher utilisation of whatever virtualisation infrastructure you choose than would otherwise be possible.

My preference would be implement microservices with a statically typed language like Java, Scala or Go on the backend because I prefer the properties of statically typed languages and they offer reasonably good performance. Others might prefer to use dynamically typed (platforms/)languages like node.js, ruby or Python although high-performance and scalability isn't necessarily as easy to achieve with these languages.

Should you use MySQL or something else? Either MySQL or Postgres are probably reasonable choices in the first instance and provided you have encapsulated access to them behind well-defined, stable microservice interfaces then you should be able to revisit that choice without too much grief later on.

See Questions On Quora

Posted on 17 June 2015

Is Node.js declining already?


I think Node.js is stronger than ever. With io.js and the Node.js foundation and the exceptional community and tooling that Node has, it'll stick around for a very long time.

That said, it's very possible that the hype is decreasing as people are finding real practical applications for it rather than trying to apply it to everything. I personally do not believe that Node is a viable platform for building multi-user server logic. Node is great for asynchronicity, but that shouldn't be confused with concurrency* which is really what you want in those scenarios (I can write a list of things Node doesn't do well for building safe backend systems, but that's one example).

The Node platform is very good for single-user applications (games, web apps, command line tools, "browserified" apps, Node+browser containers), but I think a lot of people will come to regret using it for bigger backends. And the result of that might make it appear as if it's declining.

* Concurrency is not parallelism (nor asynchronicity)

See Questions On Quora

Posted on 13 June 2015

What are the best ways to scrape the AJAX driven websites?


There are so many ways to scrape websites, either those are AJAX driven. But let me tell you one thing. I am using one and the best tool from the last three years that is called Easy Data Feed - Web Data Extraction Scraping Software.

It is:
Working Well
Free
Open Source
Always kept updated
Anybody can download it
It is free of cost
It is basically used to extract any type of data, we can scrape them easily either those are AJAX driven or they have JSON too.

See Questions On Quora

Posted on 5 June 2015

Is it common for JavaScript programmers to not learn much of the language?


I'd say it's very common for them not to learn much of the language - after all, a significant percentage, if not the majority, of people who have used JavaScript have used it for nothing more than making a web page a little bit more interactive.

It's very likely that in using JavaScript for such an abstract task, they probably only used some very basic features of the language, like a few loops, functions, object methods and properties, and variables. Very likely the only major API/library they used was the DOM and a few event handlers. Probably also jQuery.

In reality, JavaScript (or rather ECMAScript) is a whole lot more sophisticated and has a whole lot more features than what you'd use to make your HTML table sortable, but many people use as little JavaScript as possible.

All of this is a bit of a shame really, because JavaScript is really good at being both a functional language and an object oriented language, and has managed to in part make asynchronous and event-driven programming a little more accessible. If your only experience with JavaScript is playing around with the DOM and discovering that == doesn't do what you think, you're missing a lot of knowledge.

See Questions On Quora

Posted on 18 May 2015

Why do a few of my co-workers argue that JavaScript isn't real programming?


To be fair, the naming and positioning of JS have created a lot of confusion.

For many people the first exposure to JS is that it's the scripting language that you use to glue various pieces of html together to make them dynamic. The history of such glue/stitching/scripting languages is somewhat sordid, c.f. Perl.

Then they hear that it doesn't have first class typing.  And then they probably heard that numbers are always represented as floating point.

Once you know these things, it's easy to put JS into a certain box, write it off and ignore it.  I know I did and I like to think of myself as very objective and all about tradeoffs.

I was wrong.

The lack of typing and the all numbers as FP is still a PITA but it's actually quite a complex and subtle beast, with the implications of the inheritance/templating model thought out deeply at its inception.

I now think it would have represented its capabilities better if it had called itself SchemeScript.

I still think the whole numbers-as-FP thing is kind of bad since it makes handling money notoriously difficult.  I've been raised on strongly typed languages since leaving BASIC many many moons ago so the lack of strong typing is somewhat annoying especially in that it greatly increases the importance of rigorous thorough testing.

What you do is your decision.  You should make a socially appropriate choice.  Educating people is a good choice but it can be difficult to reeducate people who already have made up their minds.  It's very hard to say what's right in a context-free fashion.

Perhaps the most important lesson is to yourself keep an open mind as you move forward.

See Questions On Quora

Posted on 20 March 2015

Why do a few of my co-workers argue that JavaScript isn't real programming?


I have a simple approach for dealing with this particular class of co-worker.

If they won't believe you when you say JavaScript is programming and that what you are doing is simple markup, agree with them.  Then offer to get them a workstation and inform them that if they understand this better than you, they must be able to do your job better than you, hand them the tools and say "Here you go!  Prove me wrong by being better than me!".

Then watch how fast they backpedal from their statements.  More often than not this is a situation of someone having a little knowledge or picked up something via osmosis and think they know a lot.  Very common among non-technical people who interact with technical staff or deal with procuring solutions.

But do not ignore them.  Challenge them and work to educate them.   As my "get them a workstation and do my job better than me" example illustrates.  Harsh but effective.  I've only had to do it a few times but it gets people who think they understand technology and implementation of it to think about what they are saying and make them "put up or shut up".

A less cruel way is to actually sit down with them and walk through the logic they believe to be missing.  Show them how the code works.  Ask them to even work with you to write it.  Either way, they'll get the message.

If you ignore them eventually they are going to make a promise to someone else, usually higher-up, that is impossible to meet but leave you holding the bag.  By not challenging their assumptions you are silently saying they are correct.  This can be a fatal, career-ending mistake. 

If you can't bring them around and show how yes, you are a programmer doing programming things, update your resume and start looking.  Such a toxic environment will eventually cause you to bear blame and outcomes that you didn't create out of their own naivete and uncorrected ignorance.

See Questions On Quora

Posted on 20 March 2015

What are the most interesting HTML/JS/DOM/CSS hacks that most web developers don't know about?


Use download attribute with file download links, like:
<a href="fileurl" download="report.pdf">download></a>
when you need to place download link on your site. Without
download
attribute backend developer have to add some special HTTP-headers to response in order to start downloading process. Also, you can specify user-friendly filename (like 'report.doc', 'cv.pdf', etc), when you store files with long, unreadable names.

See Questions On Quora

Posted on 16 February 2015

I am Java developer who wants to learn JavaScript. Which technology, Angular, jQuery, or Node.js is better to learn nowadays?


Welcome to the front, Java developer! Good to have you.

In comparison to other languages, the JavaScript community changes methodologies, frameworks, build systems and even their virtual machines like most people change their socks. It is therefore much more important to have a fundamental understanding of the language itself, rather than learning a specific framework idiom. If you invest heavily in a certain technology, you'll be in for a world of hurt.

Luckily, JavaScript is also a very small language compared to other languages, so you'll be able to assimilate it quickly. I always recommend people to start with JavaScript: The Good Parts. It's a few years old, but since JavaScript is an open standard the language itself changes very slowly.

All that said, the things that are hot right now in the JavaScript community are (and this list is biased as hell):
  • React and Flux is the hot new thing (especially the just-released React Native. Developed and used by Facebook. It is really good.
  • Angular (the old but popular, big thing, developed by Google). Currently between two very different major versions so I'd stay away for a few months until the dust settles.
  • Backbone is a good-old MVC framework for use in the client side of things.
  • node.js and io.js. They are the same thing, where io.js is a recent fork. Think the hudson/jenkins split. Use node.js for now, but there is a good chance that io.js will win out, so be aware.
  • npm is the major package manager for JavaScript. It's has a module for goddamn everything. There is also jspm and bower. jspm is nice but too new, but Bower is stupid and should be avoided.
  • Browserify is the best thing since sliced bread - it allows you to use npm modules in the browser, not just the server.
  • Gulp and Grunt are build systems. Gulp is the newer one, but pretty mature. It's the one you should use.
  • express.js is what you want if you want to build stuff server-side.
  • Meteor is a super futuristic and cool full-stack framework that is awesome but does pretty much everything in a different way than everyone else. It's very popular, and you should definitely try it to get your mind blown.
  • jQuery is to JavaScript what Wordpress is to PHP. Everyone learns it and then tries to do everything with it. You should not do this. jQuery is a good tool for DOM manipulation, use it for that and nothing else.
  • Learn some functional programming. This is the best way for me to ensure that you can never go back to Java. See my answer to What is a simple explanation of higher order functions and callbacks in JavaScript?

I know, this all feels overwhelming. That feeling doesn't really go away, just embrace it. Breathe deep. Wooooo!

Oh, and if you like my writing, don't miss out on more of it - 
follow me on Quora and Twitter (http://twitter.com/mpjme)

See Questions On Quora

Posted on 12 February 2015

What is the best way to handle floating point problems with financial calculations in JavaScript?


Never use floating-point numbers for financial calculations. As you have observed, this leads to rounding problems because most decimal fractions like [math]0.1_{10} = 0.00011001100110011\dots_2[/math] have no exact finite representation in binary.

Instead, just represent all monetary values using an integer number of the smallest relevant units of the currency, e.g., cents. You don’t need a special library for this. Plain JavaScript numbers are guaranteed to be able to accurately represent every integer between [math]-2^{53}[/math] and [math]2^{53}[/math], and [math]2^{53}[/math] cents is about nine quintillion dollars.

(Don’t divide by 100 again and convert to dollars, like the example you gave. Just leave everything in cents.)

See Questions On Quora

Posted on 28 January 2015

How many boring steps in programming were there for you, before it became exciting?


I got stuck playing Grand Theft Auto: San Andreas on my PC! I had to figure out a way to get rid of the update to unlock my old saves. I ended up messing with one piece of the source code that was open to modify, it was written in C (If I only had known what C is).

I went to buy this book (This exact copy) for $75. In North Iraq $75 is a lot of money:

My cousin, Misho, who was an actual Engineer at the time told me few things:

  1. First, that is C++, you wanted C, those are not that close. AND no the ++ doesn't mean a better version. (My logic back then :/ )
  2. Second, this is for someone who can understand at least College level English, wait do you even know what a TextBook is Yad?
  3. Third, why did you break the game again? It doesn't look like that you are going to be playing it anytime soon.


Hence, the journey started my friend! I went on an epic mission to fix the game back! Didn't know what was coming, it got dark really fast.



I ended up making a MOD on the game and never being able to fix it. I downloaded the free available 3D car models and added them to the game.
My first 101 programming project as a 16 years old (It was one of the most exciting things I have ever done in my life).

When I showed the game Mod to my friends, the reaction was something like this:

For those who are interested here is what the game ended up like:
Hitman: Blood Money MOD in GTA :):

I found a Forum that gave all the Car Models for free and I gave them my Mod for free. Back then startup tactics was such simple!

https://www.youtube.com/watch?v=...

See Questions On Quora

Posted on 14 January 2015

Is it wise to invest into RefluxJS with Facebook's React?


I am the current maintainer and creator of reflux. It started out as an simple implementation of Flux, back when Flux was just an example project in React's codebase, but got refactored early on when I wanted to make it Functional Reactive Programming (FRP) friendly.

The initial architectural differences between reflux and flux is detailed early in the README file in the project:
  • The singleton dispatcher is removed in favor for letting every action act as dispatcher instead.
  • Because actions are listenable, the stores may listen to them. Stores don't need to have a big switch statements that does static type checking (of action types) with strings
  • Stores may listen to other stores, i.e. it is possible to create stores that can aggregate data further, similar to a map/reduce.
  • waitFor is replaced in favor to handle serial and parallel data flows:
    • Aggregate data stores (mentioned above) may listen to other stores in serial
    • Joins for joining listeners in parallel
  • Action creators are not needed because RefluxJS actions are functions that will pass on the payload they receive to anyone listening to them

The most profound effect out of this refactoring is the lack of central dispatcher that leads to cleaner store implementation, less verbose actions and (according to Krawaller) dispatcher that is now "unicorns and rainbows".

On top of that reflux also provides functionality that has been provided by the community such as React mixins to make the connection between stores and components easy, child actions for e.g. easy handling of web apis, and as of lately stores with built in mixin functions.

A blog post worth reading is Krawaller's Reflux refinement, that details some differences between flux and reflux further with some features the author and others has helped contribute.

You could try writing your own implementation of Flux or you could just go with the most popular one (Reflux right now has +1000 stars on github) that works well enough for web applications. One such project, other than the obvious todo example project, is Sony's Lifelog web interface. If you think some features are missing and are willing to help out, I'm happy to receive Pull Requests on Github.

See Questions On Quora

Posted on 7 January 2015

Are all dynamically typed languages as "liberal" as JavaScript?


Yes, most of them are pretty messed up, and this derives from the basic problem with: "On the left we have this thing which could be anything. On the right we have this thing that could be anything.  ¯\_(ツ)_/¯ Are they 'equal'?"

A lot of the time these "things" don't even behave like values. This kind of "flexibility" is not a virtue, and it causes innumerable bugs.

Here's PHP.



See Questions On Quora

Posted on 7 January 2015

I've been coding for some time now, and have developed several web applications entirely, two of which are largely used. To this point I haven't used any algorithms, or even much math. Why?


I need to answer this question. Its clear why you are not using any algorithms: because your application is doing nothing. You are probably moving data in and out of a database and showing it to the user but In the end you are doing nothing, nothing at all.

There is a huge circle of companies creating software to just move data around and companies buying that too.

Programming is like painting, a few think about the Sistine chapel but most just paint white walls.

See Questions On Quora

Posted on 10 December 2014

What is the technical difference between prototype-based inheritance and class-based inheritance?


With classical inheritance, you have a cookie-cutter object (a class) that isn't a cookie itself but which makes cookies (object instances). With prototypal inheritance, you just start with a cookie and, when you want others, you copy it. Or you use it as a delegate, so that it can do the work of other objects. In any case, there's no cookie cutter/blueprint/class that is inert by itself but which makes other objects.

In Javascript, which is the most popular prototypal language, it's a little hard to see that classes don't exist, because the most common way of making instances is to use a function:

function Person(name) {
  this.name = name;
}

var jennifer = new Person('Jennifer');

But the function is really just a way of creating a new object, adding properties to it (e.g. name), and attaching a proxy object to it. In other words, it's a sort-of factory function, not a class.

In the above example, I didn't make use of the proxy, but it exists. It's called "prototype," which is a horrible name, because it sounds class-ish. I wish Javascript used the word "proxy" instead.

function Person(name) {
  this.name = name;
}

Person.prototype.sayHi = function() {
  alert('Hi. My name is ' + this.name);
}

var jennifer = new Person('Jennifer');
var bob = new Person('Bob');
jennifer.sayHi();
bob.sayHi();

Neither the jennifer nor the bob objects have a method called sayHi. What happens when you try to call one, as if it exists, is that the Javascript interpreter looks for it, fails to find it, and checks to see if it's implemented on a proxy object, instead--a proxy object that jennifer and bob are linked to. The proxy can act for the object that users it. It can "sayHi" for bob and jennifer.

Javascript creates this object behind the scenes (and attaches it to bob and jennifer behind the scenes, too), but if you could see it, it would look like this:

{ sayHi: function() { alert('Hi. My name is ' + this.name); } }

When the function gets called, the key-word "this" gets resolved to whichever object, jennifer or bob, is using the proxy at the time.

Proxies are like saying, "Sorry, but you can't have a bicycle, but I'll tell you what. There's a communal bike you can all use."

Here's a newer (ES5) way of hooking a proxy up to some objects:

var proxy = { sayHi: function() { alert('Hi. My name is ' + this.name); } };

var bob = Object.create(proxy);
bob.name = "Bob";

var jennifer = Object.create(proxy);
jennifer.name = "Jennifer";

All you're doing here--in both approaches--is linking objects together. You are not creating instances from a blueprint.

See Questions On Quora

Posted on 9 December 2014

Being easier to understand and write, why hasn't CoffeeScript gained popularity over JavaScript?


I really like CoffeeScript and almost always use it whenever I can, but it it's not going to replace JavaScript. What is more likely is that JavaScript will pick up features from it over time.

1. CoffeeScript is really just very nice syntactic sugar on top of JavaScript. You have to know JavaScript to use it, and you have to know it pretty well too. Starting out as a programmer with just CoffeeScript seems like a big mindfuck for me.

2. CoffeeScript is easy to write and looks super sleek, but pretty hard to read unless you're experienced with it. The comprehensions and the fact that you can omit parenthesizes encourages writing code that is minimal, yet incredibly hard to skim for a human. One thing that I've learned from CoffeeScript that while parenthesizes are ugly, they do a lot for readability.

3. JavaScript is an OLD language. It's been around. To topple any product in any category with that kind of dominance, you need something that is not 20%, you need something that is at least 200% better. CoffeeScript is not.

4. CoffeeScript does not have any standalone interpreters - it depends on JavaScript interpreters, so there is not even the foundation in place so that it could replace JavaScript.



See Questions On Quora

Posted on 13 October 2014

Why should one use callback in JavaScript? What are its advantages?


Think about the word "callback" and how it's used in normal English: "Hey, Bob. Please call me back when you decide whether or not you're coming over for dinner."

The implication is that Bob can't answer yet. But when he's finally made a decision, I might not be around to ask him the question. So I say, "Please answer this question when you can." A callback is a way of asking a question (or requesting a task) in advance.

button.addEventListener('click', callback);

I don't know when the user will click the button. But whenever he does, I want a function called.

The whole point of functions is to set aside processing that can be done later, at any arbitrary time. When that time comes, we want the function to "call us back." Really, all functions are callbacks:

1
2
3
4
5
6
7
//When I ask you to call me back, here's what I want you to do:
function foo() {
  console.log('Hi. I'm calling you back');
}

//Request to be called back
foo();


Callbacks can also aid expressiveness by hiding some boring details. For instance, let's say I have an array of numbers, and I want to filter out all the ones that are less-than five. Here's a solution without callbacks:

1
2
3
4
5
6
7
var original = [1, 8, 7, 2, 14, 3, 5];
var filtered = [];
for (var i = 0; i < original.length; i++) {
  if (original[i] > 5) {
    filtered.push(original(i));
  }
}


It kind of sucks that I have to write out the loop mechanics, as that's a boring implementation detail. It's how the task needs to get done, but it's not what the task is. Why can't the computer take care of the how while I just worry about the what?

Here's a functional version, using a callback:

1
2
3
4
var original = [1, 8, 7, 2, 14, 3, 5];
var filtered = original.filter(function(num) {
  return num > 5;
});


There's still a loop occurring, but Javascript is taking care of it for me. I'm just worrying about what I want the loop to accomplish.

Since you can pass functions as values in Javascript, this allows you to easily defer all sorts of processing until run-time:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
//assume a variable called userHatesBigNumbers
//has earlier been set to true or false.

function isSmallNumber(num) { return num < 5 }
function isBigNunber(num) { return num >=5 }

var filterFunction;
if (userHatesBigNumbers) {
  filterFunction = isSmallNumber;
} else {
  filterFunction = isBigNumber;
}

var original = [1, 8, 7, 2, 14, 3, 5];
var filtered = original.filter(filterFunction);


See Questions On Quora

Posted on 24 September 2014

What's the difference between a promise and a callback in Javascript?


I'm going to quote a blog post I wrote recently for my employer
http://engineering.onlive.com/20...


If you’ve done any serious work in JavaScript, you have probably had to face callbacks, nested inside of callbacks, nested inside of callbacks. This is especially true of code written in node.js, since every form of i/o, such as file reads, database reads and writes, and memcache access, is asynchronous, and most code needs a more than a single i/o call. You may end up with code that looks something like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
function isUserTooYoung(id, callback) {
    openDatabase(function(db) {
        getCollection(db, 'users', function(col) {
            find(col, {'id': id},function(result) {
                result.filter(function(user) {
                    callback(user.age < cutoffAge)
                }
            }
        }
    }
}


Pretty difficult to follow. And it can get much worse. In our current node.js codebase we sometimes do as many as ten sequential, asynchronous calls. That would be a lot of nesting. Thankfully, there’s a much better way: promises.

What is a promise?

A promise is a proxy for a value not necessarily known at its creation time. With promises, rather than an asynchronous call accepting a callback, it instead returns a promise. The calling code can then wait until that promise is fulfilled before executing the next step. To do so, the promise has a method named then, which accepts a function that will be invoked when the promise has been fulfilled. As an example, the following is the above code rewritten using promises:

1
2
3
4
5
6
7
8
function isUserTooYoung(id) {
    return openDatabase(db)
        .then(getCollection)
        .then(find.bind(null, {'id': id}))
        .then(function(user) {
            return user.age < cutoffAge;
        });
}


Much easier to follow, no?

When then invokes a the specified function, that function receives as a parameter the resolved value of the promise. So, for example, when getCollection is called, a handle to the database will be passed to it.

That's essentially it. If you have any questions, just leave them as comments.

See Questions On Quora

Posted on 11 August 2014

Is there an online course to learn front-end web design (HTML,CSS, Javascript)? Where?


At Bloc, we have two courses you should look into:

Our UX design program focuses on fundamentals of the user experience design process, creating wireframes, designing mockups and then producing code to prototype and test those sites. The front-end course takes that skillset even further, teaching you more advanced Javascript, jQuery and using frameworks like Angular to help build web applications.

Depending on how much you would want to learn and achieve, we have a class that's fit for you. It's all online-based, with one-on-one mentorship to help you get to where you want to go.

In the meantime, if you're looking for some basic HTML and CSS skills, you should check out our book on building your first website (https://www.bloc.io/build-your-f...). You'll learn the basics of HTML and CSS, how to use a text editor, structure content on a webpage, style it and deploy it to Github Pages for free. It's a nice crash course for beginners.

Disclaimer: I am the design director at Bloc, in charge of creating the curriculum for our UX design program.

See Questions On Quora

Posted on 21 July 2014

What can PHP do that JavaScript can't?


This is a bit like asking what you can say in German that you can't say in English. In general, there is very little that you can't do with programming language X that you strictly cannot do in programming language Y. Almost all programming languages are pretty general-purpose, and it's more about what one language is more suited to do. There are of syntactical differences about how you do things in one language but cannot do in the other (For example, PHP has variable variables while JavaScript has closures, and German has the excellent word Schadenfreude) but that's generally just different ways of approaching things.

Also, to clear some things up, because I feel there is a bit of misinformation going on in other answers:

Both JavaScript and PHP can run server-side. Web browsers have JavaScript engines built in, and this makes a lot of people assume that JavaScript is for clients and PHP is for servers. This is false. JavaScript is widely used in production server-side, using node.js. Node.js is not another language, it's just JavaScript. Simple, low-cost options are available for small deployments, and large companies like PayPal uses it in production.

Both JavaScript and PHP are object-oriented, and has extensive support for inheritance and polymorphism. PHP is more classically oriented and you will be more comfortable with it if you're coming from a background of Java, while JavaScript has a more flexible (but harder to understand) inheritance model called prototypal inheritance. JavaScript and PHP both have classes, but PHP has a more extensive support for them. (You tend not to need classes as much in JavaScript though for a number or reasons, but that's beyond the scope of this answer).

Both JavaScript and PHP both have extremely cheap hosting options available. For initial small-scale deployments, both have very cheap or free options available and when moving to VPS or bigger they both have similar performance requirements.




See Questions On Quora

Posted on 19 April 2014

How does one decide which Javascript framework (e.g. Node, Backbone, Angular) to use on any given project?


If you are just learning JavaScript, I suggest trying to work without any frameworks or libraries at all. Starting with something like Angular will make it much harder for you to learn the core language and browser APIs.

Once you've worked with raw JavaScript for a while, it's worth starting to learn jQuery - it's the basis of most of the popular JavaScript frameworks out there and understanding how it works will help reinforce a bunch of core JavaScript concepts.

If your priority is learning though, it's a good idea to start without jQuery. There are a surprising number of JavaScript developers out there who only really know how to program JavaScript using jQuery.

See Questions On Quora

Posted on 11 March 2014

Why is there a compiler for C++ and Java, but not for JavaScript?


It kind of depends on what you want to call a "compiler". The term is often restricted to translating a source language into native code that can run on the hardware, but it is more generally applied to any transformation (especially one that is at least "nearer" to the hardware in some sense).

A Java compiler, for example, translates into a platform-independent virtual machine.

That virtual machine code could be interpreted, but more often it's translated into machine code by another compiler. For Java machines, that's generally done just before it runs, so that it's specific to the exact hardware that it's running on. That's a "just-in-time" compiler. It can even re-compile the code as it's running for better performance for this specific run.

A C compiler, by contrast, will generate machine code for a variety of related hardware. Even that gets more and more "virtual" over time: that native code will contain hints for specific hardware that it might be running on. And the system itself will rearrange the instructions ("pipelining") to take best advantage of the hardware.

The major Javascript engines have just-in-time compilers. It's possible to do a direct-to-hardware compilation, and somebody's probably done it, but there's not much of a point to it. All languages are equivalently "expressive" in the Turing tarpit, but the library features and major implementations are generally tuned to make some use cases more important than others.

C is used primarily for close-to-the-hardware applications like device drivers and operating systems, so it's compiled natively. Java is used for more applications-oriented programming, where you want it to be flexible for a variety of systems, so it gets that intermediate step that makes it easier to do a final hardware compilation.

And Javascript is used primarily for web applications, where you want to be really, really flexible, so it's distributed as source code. The nature of the language, where programs can be composed on the fly, is also well suited to a later compilation.

Minor rant: and that's why it's comparatively slow. It wasn't designed to run fast, and the Javascript engine makers have had to go to truly superhuman efforts to make it run with acceptable performance. They have, however, learned a lot over the decades of writing other compilers, and the language ends up being good enough for a lot of uses far larger than anybody would have ever expected. I still think it would have been better to use a virtual machine, and we may well get one if Google gets its way.

See Questions On Quora

Posted on 14 January 2014

Why is $ used in jQuery?


JavaScript allows the
$
character to be used in variable names. There is absolutely nothing special about the dollar sign as far as JavaScript is concerned, so without jQuery,
$
is just a variable name. More concretely, in JavaScript, you can do
var $ = 5;
or
var $a$b$c$ = 6;
and all will be well with the world. jQuery uses this happy fact to alias the
jQuery
function to
$
just so you don't have to type
jQuery
over and over again. A similar approach is taken by Underscore.js, which uses
_
(also a perfectly valid variable name) instead of
$
. By the way, the current ECMAScript standard actually allows you to use some Unicode characters in variable names. That's right,
var ಠ_ಠ = 7;
is perfectly valid JavaScript.

As far as why the
$
character was chosen in particular, it's one of the few symbols on your keyboard that's allowed to be used as the first character of a JavaScript variable name (
_
being the other one). If you're really interested, you can read http://www.ecma-international.or... for the definitive source of valid/invalid characters for JavaScript variables.

See Questions On Quora

Posted on 9 January 2014

How can a developer find a technical co-founder in a week?


Don't.

Your mission is not to get accepted to TechStars. Your mission is to build a successful business.

To do so, you need to devote a great deal of time to finding your co-founder. You need to talk to lots of people, spend time with candidates, then do a trial run where you work together for a while before committing.

I'd also recommend reading the excellent "Founders Dilemmas" by Noam Wasserman. It will tell you everything about the structure and interpersonal dynamics of founder relationships that you need to know.

Spend time and get this right. TechStars isn't going anywhere.

See Questions On Quora

Posted on 23 December 2013

What companies are using Node.js in production?


We are moving every product & every site within PayPal to Node. We started the journey by using it as prototyping framework, then at start of this year we hardened it to work with all PayPal systems. We have several of our beta products out live on NodeJS and half dozen other products in flight. By end of 2014 we hope to have all major experiences redesigned, and rewritten on nodejs.

NodeJS is a forcing function to completely obliterate the old stack and the old experiences.

We are seeing big scale gains, performance boosts and big developer productivity. You can see a talk I did on this here:

http://www.youtube.com/watch?v=t...

See Questions On Quora

Posted on 31 October 2013

What is the javascript code for disabling right click in a webpage, without using activex?


Please don't


I can easily type ctrl-shift-i and override your function in JavaScript console. All you do is annoy your users when they, for example, want to right-click on a link to open it in a new window or bookmark a link.

There are countless browser extensions to download every image asset from the page. It's just pointless and aggravates users.

See Questions On Quora

Posted on 28 September 2013

What are the tradeoffs of client-side rendering vs. server-side rendering?


1. Browser compatibility issues. The more operations you leave up to the browser, the more quirks/incompatibilities you run into.

2. SEO. Client-side rendering means that crawlers will have trouble indexing your site. There are workarounds that work perfectly fine (PhantomJS), but it's just one more piece of complexity to worry about.

3. Latency. On initial page render, server side rendering is much faster than client side rendering. But on subsequent page updates or when rendering new child views, server-side rendering is going to be much slower and less responsive because you have to make a network request and re-render most of / the entire page when data changes. Whereas with client-side rendering you can offload subsequent processing to the client and selectively re-render portions of the page for more responsiveness. This tradeoff is a bit blurry because any given app can have varying degrees of server-side/client-side emphasis - it's a sliding scale that ranges from HTML with a sprinkle of jQuery to a full-blown framework like Angular or Ember.

Modern web development is definitely moving towards client-side rendering. Issue #1 will slowly dissipate as people upgrade their browsers, especially to auto-updating browsers. Issue #2 will be fixed once the googlebot (and the bingbot?) gains the ability to fully run JavaScript (right now there is only partial support), which is actively being worked on.

See Questions On Quora

Posted on 5 July 2013

What are some best practices to use when making a website that uses a lot of AJAX?


Some tips:
  • Make a reasonable effort to make sure your site works without AJAX. Most cases, this is easier than you think; like making sure forms can post themselves, things have correct
    href
    attributes etc. This also helps if your JavaScript capable browser somehow fails to load the JS files to handle actions.
  • Make sure you authenticate your AJAX calls on the server side, with some sort of authentication token or something. You'd be surprised how often this is skipped, especially when using vanilla PHP apps.
  • Try to cover some edge cases like server not responding on time, server responding with bogus responses, users double clicking things, users clicking things and then navigating away from the page, users clicking more than one actions, users trying to revert their actions.
  • Essentially, don't let the user mess with your data and don't let the user get confused. Use a non-deterministic progress indicator (i.e. a spinner) to give user an indication of something happening. On success or fail, again, give proper feedback.
  • That being said, don't immediately clutter your code to cover the edge cases, especially if it's a smallish app. In general, just having a way to handle all type bogus responses (like things that are not JSON encoded) is good enough.
  • Speaking of, don't bother with XML. Just use JSON. I know some people like AHAH[1] and other things but using JSON all around and even putting HTML fragments in JSON if necessary is probably make your life easier in the long run.
  • Do your best to not break the Back button on browsers.
  • If you load everything via AJAX, make sure specific pieces of content are still bookmarkable (have permalinks). Using URL fragments is one way to do it but most likely, there's a better way. This is also generally good practice for SEO reasons.
  • Do learn JavaScript, don't just use jQuery scripts you see around (other than abstracting out browser quirks for AJAX calls). Functional nature of JavaScript lends itself very well to handling things with callbacks. Learn and love them.

1: http://www.xfront.com/microforma...

See Questions On Quora

Posted on 3 June 2013

How would you explain objects in JavaScript to a child?


A Javascript Object is like a Mr Potato Head.

mrPotatoHead=new Object();


Every Mr. Potato Head has 'properties', or words that describe him. To assemble a Mr Potato Head out of all his properties, we can use literal notation:

1
2
3
4
5
6
var mrPotatoHead = {
     mrPotatoHead.height : "6 inches",
     mrPotatoHead.width : "3 inches",
     mrPotatoHead.isMarried : "true",
     mrPotatoHead.wife : "mrsPotatoHead"
}


Or we can use a constructor function:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
function mrPotatoHead() {
     this.height = "6 inches";
     this.width = "3 inches";
     this.roasted = function(){
          var i;
          var slices;
          for (i=1,i<=mrPotatoHead.length;i++) {
               slices+=slices;
               }
          lunch = bake(slices,salt,pepper,oliveOil);
          return lunch;
     };
};


That last part is the beginning of a nice snack, but is a little advanced for children, and the bake(); method is beyond the scope of this tutorial.

Some properties describe things he has or is wearing:

1
2
mrPotatoHead.hasOwnEyes = true;
mrPotatoHead.hasOwnPants = false;




Methods are things we can do to Mr. Potato Head. Sometimes it's a simple action:

mrPotatoHead.addPants();


Sometimes we need to give him more information by adding a parameter inside the parentheses:

mrPotatoHead.replaceNose(theOneLikeAClown);





JavaScript isn't what's called 'typed', so if we put in the wrong type of variable, it will do its best even if it doesn't make sense to mix types.

mrPotatoHead.replaceRightEar(rightArm);




It will usually work anyway, but, yeah, it's best not to mix types.

Isn't that how everyone learned it? :-/

See Questions On Quora

Posted on 21 April 2013

Exactly why does ['10','10','10','10','10'].map(parseInt) return [10, NaN, 2, 3, 4] in JavaScript?


  1. map
    calls the function with three parameters. The first is the element, the second is the index in the array (the third is the array itself).
  2. parseInt
    takes two arguments. The second is an optional argument specifying the radix (the base) to expect the string in.


Try some things:

1
2
3
4
5
6
['10','10','10'].map(function(x,y) { return y; });
// → [0, 1, 2] -- These are the indices of each element

parseInt('10', 0); // → 10 -- Defaults to base 10
parseInt('10', 1); // → NaN -- There is no such thing as base 1
parseInt('10', 2); // → 2 -- 10 in base 2 is 2


The solution is:

1
['10','10','10'].map(function(x) { return parseInt(x); });


EDIT: Thanks to Prithviraj Udaya's answer I've edited this to say that map calls the function with three parameters, not two as I originally said.

See Questions On Quora

Posted on 25 January 2013

What is the significance of jQuery?


In no small way jQuery accelerated the proliferation of the non-static web, or "web 2.0."

The milestone I use as a marker for the start of the Web 2.0 (AJAX-driven web app) has always been Gmail.  It did things no other website even attempted at the time, when most sites were content being static pages of HTML + a tiny bit of CSS. Javascript was not considered a serious language and support was minimal. Nobody outside of a few engineers at Google and devoted JS evangelists understood how each browser ran code.

jQuery made it really easy for anyone to programmatically access and manipulate a page. Easy for engineers who otherwise wouldn't touch a website; easy for designers who wouldn't touch code. It massively added to the number of websites and developers who aspired to build something more than text + images, whether that meant animations, complex forms, or responsive apps rivaling that of contemporary desktop software.

Of course, there is downside to this progress.  It's very easy to write bad jQuery code.   Additionally the library prefers ease of use at the expense of imposing stricter/better engineering practices. Still, I think it's a net positive – there are plenty of other JS libraries if the fast-and-loose style of jQuery leaves a bad taste in your mouth.

See Questions On Quora

Posted on 3 January 2013

What is the best way to educate yourself on HTML, CSS, JavaScript, and AJAX?


I have to recommend Udacity's Web Development Course.
Web Development Course (CS253)

Its taught by Steve Huffman (Reddit co-founder) and it will take you through the essentials of both front-end and back-end development. You'll finish the class with a sound understanding of the relationship between server-side and client-side technologies. Plus, Steve's experience building and scaling Reddit makes the class highly engaging.

The Course covers the following: (HTML,CSS, Javascript, GET/POST, HTTP, Cookies, JSON, Sessions, Database, Scaling, memcached, MySQL, Web Security, Hashing, Salting, Load-balancing, Templating).

At this point- go build something. Single page website, simple web utility, anything. You'll learn bucket-loads in the process.

With the essentials under your belt, I'd recommend becoming a jQuery wizard. Nearly everything sleek that happens on a webpage is through Javascript, and jQuery just makes Javascript development that much faster, cleaner, and stable. Codecademy does a pretty good job teaching the essentials of jQuery selectors and DOM manipulation.
http://www.codecademy.com/tracks...

As for AJAX, jQuery will make it pretty easy for you to make asynchronous calls to your server.

Lastly, going through tutorials is always a way to expand your knowledge through experience. Its akin to building something new, but you're guided along the process so its a bit more time-effecient for learning purposes.

My favorite Web Dev Tutorial site:
http://net.tutsplus.com/

Happy Development!

See Questions On Quora

Posted on 9 November 2012

How will mobile carriers react to iMessage?


AT&T responded by eliminating all of their metered SMS plans. Before the change you could pay for a certain number of SMS messages sent/received per month (500/1500 I believe).

They changed their rate plans to only have two options:

  • $0.20/message sent/received, no monthly fee
  • $20/mo, unlimited messages sent/received.

For people that receive or send over 100 SMSes per month the unlimited plan is now a better deal, and new customers are unlikely to choose al-la-carte prices when signing up for service. AT&T forces everybody into an extremely lucrative unlimited plan, leading to customers ignoring their SMS usage as iMessage/Facebook Messages/etc begin to take away their traffic.

Most users will never elect to remove the unlimited package from their monthly bill and SMS charges will become even more profitable in the long run as their overall volume decreases to zero.

See Questions On Quora

Posted on 25 September 2012

Why is JavaScript the only client-side language available?


Before I go on answering your question, I must point out that JavaScript is a pretty darn nice language. If you don't think that, you haven't given it a fair chance. It had lambdas before C#, Java and C++ added it, has higher-order functions, and has .map and .filter built into the language! In ES6, JavaScript gets proper tail calls, making it possible to do full-fledged functional programming. If you can get over the fact that it has some (avoidable) flaws it's a very, very cool language with enormous versatility.

JavaScript has some warts, but so do all languages that have been around for a while and of the same level of popularity. C++ and Java have their fair share of ugly warts, but that always comes with popularity and age. New languages look pretty when they are young, but after years of welding on features and design compromises, they too, would have warts.

The Internet is a cobweb of different technologies cobbled together with duct tape, string and chewing gum. It's not elegantly designed in any way, because it's more of a growing organism than it is a machine constructed with intent.

We engineers always look with dread upon the existing, popular tools (not just programming languages), and see all the horrors of it. Oh, the things that now, with hindsight, could have been made so much better! But you know what, the tools are here, now. They work! And not only that, they are actually pretty darn good. Not as good as the tools of our imagined future, of course, but still very useful.

What we have today might have some glaring flaws, but you just have to work around that if you want to get stuff done during your short time on earth, or you'll be stuck in a loop creating new tools instead of using what you have to help your fellow man. Try to view your flawed, present-day tools as a relationship - your wife, girlfriend or partner will have some pretty big issues no matter how awesome they are, and that is just something that you have to work with, because that is who they are.

But I digress. Your question was why has nobody actually managed to replace JavaScript? There are two reasons.

The first reason is that people simply underestimate how hard it would be to replace. Designing a fantastic, spectacular language would only be 0.0001% of the work. Getting a language to the point where JavaScript is today is a task on the same level of difficulty as solving the Israel-Palestine conflict. Millions of hours of development time and other efforts have been spent to get JavaScript to have the advantages it has today:
  • Built in into all major browsers.
  • Multiple, well-maintained open-source engines available (JavaScriptCore, SpiderMonkey and V8) competing hard for faster and faster interpretation.
  • Incredibly well-known. Few people can code JavaScript properly, but almost everyone that has coded has written some JavaScript.
  • Not controlled by any major player (Apple sacrificed a lot gunning down Flash for this reason).
  • JavaScript has been very well kept as a standard. It is completely unique in that it's 19 years old, yet it has very few language constucts. C++ has an unfathomable amount of language constructs and takes years and years to master. JavaScript enjoys the same perks of maturity (massive documentation, lots of talent around etc) yet can be learned in a few weeks.
But the second, more important reason, is that we seem to want a single language. Java, JavaScript, VBScript and ActionScript were pretty active contenders at different points in time, but after a while, it turned out to be extremely beneficial for, us as an industry, to converge on one platform. It might have flaws, but the massive benefits of so many people working with a single (comparatively simple) language standard seem to outweigh that.



See Questions On Quora

Posted on 7 July 2012

Why is JavaScript the only client-side language available?


I recently had a chance to ask the same question at a meeting with several experienced web architects. They all agreed that we're stuck with JavaScript because developers know that JavaScript will run in anybody's and everybody's browser.

The one interesting trend is that Google and others are writing compilers that take non-JavaScript languages and trans-compile them into JavaScript. In this new model, JavaScript is relegated to acting as a low-level, ubiquitous runtime code.

See Questions On Quora

Posted on 5 July 2012

Should I learn Node.js or Ruby on Rails?


Node.js is where Rails was five years ago.  Now is a great time to get started with Node.js because it has great support and contributions from its community already and will only keep growing.   So learn it now so you can already be an expert when it becomes more main stream.

See Questions On Quora

Posted on 28 April 2012

What's cool about Meteor?


I really think that Meteor is a game changer.
In the words of Ron Burgundy: If you disagree, I will fight you.

Real-time collaboration is awesome.
I think this because I think that real-time collaboration will be THE SHIT in web applications of the future. Real-time notifications and updates like the one in Google Docs, Etherpad, the instant notifications of Quora and Facebook and so on make applications much more engaging and useful. When you see the contributions of other people appear immediately on your screen in response to what you did, it creates an engagement that is just not there in apps that are not real-time.

Creating real-time collaboration apps is ass-hard.
The problem is that building stuff like this is really, really hard. Quora can do it because they have the best people and a lot of them, but a small team simply won't prioritize real-time collaboration.

Meteor makes it super-easy.
The revolutionary thing about Meteor is that it pulls all the awesome that has been happening in various projects (LunaScript, Etherpad, node.js, socket.io, Mongo, ember.js etc) into one beautiful package that makes building these kind of applications approachable to mere mortal developers like me.

Exactly 6 hours after I first heard of Meteor I had created and deployed my first application - an app to suggest and vote on where we should eat lunch at work) and had deployed to the free hosting service that meteor provides. This fucker does real-time collaboration with automatic conflict resolution more or less automatically, and it was SO easy. Do you know how INCREDIBLY hard this would be to do from scratch? I sure as hell don't, because I'm to scared to even try.

The guys behind Meteor are gods to me.
Just look at this shit: http://asana.com/luna/ They have Geoff Schmidt, one of the guys behind LunaScript (http://asana.com/luna/) AND David Greenspan, creator of EtherPad (http://typewith.me/). To me, that is an extreme killer combo that can turn out nothing but awesome, and they are working on this full-time. To them, Meteor is not first-generation, they've already done this before, and learned a lot from it, and I cannot wait how this turns out.

I'm so fucking excited, man! Follow me if you're interested in Meteor, I'm sure I'll be writing tons about it..

Oh, and if you like my writing, don't miss out on more of it - 
follow me on Quora and Twitter (http://twitter.com/mpjme)

See Questions On Quora

Posted on 13 April 2012

What are the benefits of developing in Node.js versus Python?


Maybe there are none? I know that sounds like a troll, but you should consider it as a possibility. A lot is made of Node's asynchronous nature, but you can do event-driven apps in Python (and many other languages as well). It's not that hard, there is no magic.

Of course if you really love JavaScript programming then obviously Node has an advantage there. That's purely subjective though. Most programmers that I have worked with are pretty good at using different programming languages for different tasks.

Pragmatically there are some disadvantages as well. Being a younger language, you can expect more bugs, less documentation, and missing pieces. Of course all of these things are getting better all the time and there is an active community around Node. There's also a very active community around Python, Django, Twisted, etc. as well. In exchange for those bugs you get to use a technology that is considered very hip currently. You get "credibility" with some kinds of people. It's like Rails circa 2006-2007. If that kind of stuff matters to you, then that would be a huge advantage.

See Questions On Quora

Posted on 27 December 2011

What is the best way for a beginner to go about learning JavaScript?


The first step is to find a problem that truly interests you, or that you truly must solve, and which must be solved with a JavaScript solution. This will sustain you through the learning proccess, particularly when things get frustrating, which they will.

The next step is to find mini tasks you can do that are clearly within reach. Break up your main problem into mini problems. Like "how can I create a new DOM node?" and "how can I manage a click?" "How can I locate a specific page element and modify its contents."

Take each mini problem in turn, and find an answer. Write some code that only solves that problem, and use fake data. A good way to research is to open a web page in your browser, and pull up the browser's console, which all modern browsers have. Try things, see what happens.

Once you understand a concept, apply it to your problem.

Repeat until you have solved all mini problems, and then the big problem. Now you have an alpha product.

Try to find ways to break your code. Give plausible but unexpected inputs. Make sure the code still works. Have other people look at your solution and see if they can break it.

Now imagine somebody asks you to change your code. What parts of your code would you be afraid to change? Change them so you aren't afraid anymore. That's called refactoring.

Finally, show your code to a programmer better than you. As a noob, your code will likely be poorly organized, or resemble other languages you already know. An experienced programmer will help you figure this out. There is no shame in being ignorant at this stage. If the developer makes you feel bad, try someone else.

Sure, you can read a book or a website, or whatever, but what you really need is a good problem you believe in.

See Questions On Quora

Posted on 4 December 2011

What is Node.js, in layman terms?


Basically Node frees JavaScript from being stuck in the browser.  That language has been identified with browsers for so long that everybody believes it's just a browser language.  Node is a platform giving an excellent experience of writing javascript code in a non-browser setting. 

Usually it's thought of being used to build the server side of websites (similarly to PHP/etc).  But it can do much more including shell scripts etc.  It has both HTTP server and client classes built in which is where people get the idea it's for building websites.  It could be used to build something like Apache.  It's best suited for high request throughput services.

Theoretically you could do the same (server side javascript) using Rhino on the JVM.  There are other asynchronous oriented web service platforms such as Python's Twisted server. 

My book, Node Web Development, is a good introduction to using Node for that purpose and is meant for programmers who know nothing about Node.

See Questions On Quora

Posted on 30 October 2011

Is it a good idea to use CoffeeScript for Node.js code?


Absolutely. There's a chapter in my book (http://pragprog.com/titles/tbcof...) on using CoffeeScript with Node.js. The two go together like chocolate and peanut butter. The CoffeeScript compiler itself, after all, runs on Node.js (in the standard distribution, that is—the compiler can also run in just about any other JS environment, including modern browsers).

The real question is: When is it OK to run CoffeeScript directly under Node.js, and when should you compile it to JavaScript first? The two approaches yield identical behavior in most cases, but not all. I'd certainly suggest compiling to JS before distributing a Node.js library (so that it doesn't have CoffeeScript as a dependency) or deploying in production (to avoid the overhead of loading the CoffeeScript compiler into memory). But for everyday development, most projects will work fine as a collection of .coffee files. When you have the `CoffeeScript` library loaded, you can even `require` .coffee files directly, from both JS and CoffeeScript files.

In short, it's not only a good idea to use CoffeeScript for Node.js code; it's where many of the best CoffeeScripting is happening today. Look at Pow (https://github.com/37signals/pow), for instance, a Rack server running on Node.js that has more than a thousand watchers. Or check out CoffeeKup (http://coffeekup.org/), a CoffeeScript DSL that works as an alternative to Haml. CoffeeScript and Node.js are both only a couple of years old, but the combination is attracting tons of talented coders.

See Questions On Quora

Posted on 27 June 2011

What companies are using Node.js in production?


Yahoo! uses Node.JS in many products. I believe we are now the largest node.js shop in the world (measured by number of pages, users, transactions, and node.js projects).

If you are serious about being successful in the node.js community, consider spending a few years working at Yahoo, where we take node.js to Internet scale.

See Questions On Quora

Posted on 19 May 2011

Why doesn't JavaScript have the bad reputation over PHP?


Attributing Javascript success to it being "the only language for the job" is unfair. Javascript is hands down a much better language than PHP. At its core it's a fairly consistent language, which follows a few powerful principles. It's a truly dynamic language, prototype-based, that supports functional constructs, all with strong theorethical basis on older languages such as Self and Scheme. Javascript may have its problems, but at its core is a very coherent and elegant language.

PHP on the other hand was from the start much more hackish in nature. PHP was never intended to be a programming language, much less a object oriented one; it started as a hack to build dynamic pages, which solved this particular problem fairly well, and was easy enough for anybody to try. Most of its more advanced features were tacked over it as it evolved with little 'theoretical' consideration. This can be easily seen in the progression from PHP4 to PHP5 and the now dormant PHP6 project. As a result, the language does not have a coherent design.

The main problems with Javascript are in my opinion the name (which imply that the language was derived from Java, which is not true in any sense) and the DOM (which is in my humble opinion a terrible hack glued over HTML+CSS code). All the rest are conscious design decisions, which may be debatable as a matter of application or even taste, but have their own merits. The same can't be said about PHP, despite how popular or effective for the job it may be.

See Questions On Quora

Posted on 7 March 2011

What is the technology behind the New York Times HTML5 / Chrome app?


Speaking as the developer of the app:

Jacob Rothstein's rundown is impressively thorough and accurate.

It may also be worth noting some additional points:

The app runs entirely on javascript, with all visual elements rendered at run time, and usually via some sort of template.

Some details

  • AppCache + WebSQL stores the entire app for offline reading (minus images)
  • WebWorker threads load the data quietly in the background.
  • A lot of css transitions and transforms, particularly for touch screen functionality. The effect on interface performance was profound.
  • Typekit is loading our proprietary typefaces to give it that Timesy look

If there's more you want to know, feel free to ask.

Update 1:

Received a question about Solo.

Solo is an in-house framework which is currently an extraction of the juicy bits of Skimmer. Basically, I asked myself what parts of Skimmer I would want immediate access to in a new app, and teased them out.

The main thing Solo does is resolve a number of problems with asynchronicity. Most of my apps involve requesting data from a server, updating the UI, and running some animations, and any of these processes might spin off more requests, more updates, and more animations, not to mention data storage, which gets overwhelming.

As the app grew in size, I also needed a way to control order of loading components.

Solo provides a system to manage loading so that components can announce their availability when they want to, and be loaded when the app can handle them. It further provides a way to declare certain objects as communication portals, and subscribe to notices of events.

Solo also captures touch and key events and runs them through the same infrastructure.

The end result is that you write objects, and declare them to be part of the communication stream. You add a few methods to handle loading and events, and the rest is just javascript.

It strikes me as a potentially odd solution, but I've found it useful, and I've been able to turn out features at a fast clip using it.

Your next question is probably: Will you guys release it. Answer: Probably. Another developer here is looking into bringing Solo to a point where it is generally usable. If all goes well, we may decide to release the code officially.

Thanks for the question and the interest.

See Questions On Quora

Posted on 8 February 2011

What are the main weaknesses of jQuery as a framework?


jQuery is not a meant to be a framework at all. I'd say it's main weakness as a framework is that it is not a framework.

jQuery is a utility library, and it should be used as such. All framework like aspects of an application must either be self-implemented, not-implemented, or implemented by something else entirely (read: javascriptMVC).

jQuery is a fantastic tool for AJAX, dom manip, and dom api extensions (via plugins). It doesn't try to do anything else. Its main weakness is that it doesn't necessarily make this abundantly clear to those who are still learning and people get stuck trying to use it for what it isn't.

See Questions On Quora

Posted on 10 December 2010

What companies have the best team of JavaScript programmers?


Google.  One thing not mentioned yet is that Google Maps is incredibly impressive, and it was truly groundbreaking when it came out.  Between GMail, Google Maps, and other crazy projects like Wave, the Closure Compiler, GWT, v8, etc., I think Google probably needs to be near the top of the list.

280 North.  Objective-J is a little bit crazy but also kind of brilliant.  The handful of applications I've seen made with it are all really well done.

Asana.  Lunascript looks really promising, and the people I know who work there are really excellent programmers, and I know they've been pushing the limits of what current browsers can do with JS.

I agree with Yahoo and Facebook and Mozilla.  Microsoft probably has a bunch of very good people as well just because they are so large.  I would mention Lala too but they were acquired.

See Questions On Quora

Posted on 5 May 2010

What is the best way to educate yourself on HTML, CSS, JavaScript, and AJAX?


Doing beats simply reading every time so: go build a single-page site, now, then improve it as you learn.

Other resources:
http://html5boilerplate.com is a solid starting point, and reading the docs and faqs (and learning about why it includes what it does) is educational.
http://www.alistapart.com is excellent for best practices and advanced topics.
http://jsfiddle.net is a great tool to try things out.
https://developer.mozilla.org/en-US is excellent.
http://movethewebforward.org has a fantastic, long list of tons of additional resources.

Finally, while I agree with many of the other answers to this question, I have to disagree strongly with those who have recommended w3schools.com. w3schools.com is NOT a trustworthy resource. Its owners are SEO experts and prominently rank for most webdev-related searches, but the quality and accuracy and depth of their content is badly lacking. The awesome people at http://w3fools.com explain why to avoid w3schools:

We are passionate about the web, learning, and craftsmanship.
We want you, as web designers and developers, to be successful in your careers. We feel, though, that W3Schools is harming the community with inaccurate information. Like any other authoritative educational resource, W3Schools should both hold itself to, and be held to, the highest standards.
       
We hope we can illuminate why W3Schools is a troublesome
resource, why their faulty information is a detriment to the web, and what you (and they) can do about it.

-- http://w3fools.com


See Questions On Quora

Posted on 30 March 2010

What is the best way to educate yourself on HTML, CSS, JavaScript, and AJAX?


The best way to learn client-side web technologies like HTML, CSS, and JavaScript is to look at the source of websites you visit and play around with them in Firebug. Anytime you visit a website and wonder "how did they make that button look that way?" or "how is this text box sizing to content?" just inspect the CSS or JS with Firebug and dig in.

There are countless tutorials on the web about learning basic HTML tags. If you're entirely brand new to HTML, you might want to start off with some simple website templates, make little tweaks, and constantly preview in your browser to see what you did. Again, Firebug is really helpful here in that you can make changes on the fly and instantly see their effect. If you want to play with other sites, I'd recommend smaller sites that don't obfuscate their code or have so much complexity that it will just confuse you.

One of the really nice things about doing only client-side development is that you can easily preview your website on your computer by just opening the file in your browser. Throwing server-side technologies like PHP in the mix gets a bit more complicated.

For learning JavaScript, a library like jQuery makes it super simple to do things really fast. However, there's a ton of value in learning the real JavaScript syntax and I highly recommend it.

Since this question was about the basics, I won't dive too much into moderate-to-advanced topics, but it's good to learn things the right way the first time, so you should do some homework on a few topics:
  • accessibility -- Disabled (blind) users browse the web with the help of a screen reader that reads websites like a book and has keyboard shortcuts for various tasks. These tools will need your help figuring out the context of certain page elements or describing what's in an image.
  • semantic markup -- This is choosing HTML tags based on your content, not style ("presentational markup"). For example, a list of items should use the <li> tag because it's meant for lists. Sure, you could make a list with other tags, but it wouldn't be semantically correct. In addition to being the right thing to do, this helps screen readers.
  • doctype validation -- At the top of your file you should have a DOCTYPE that tells the browser what version of HTML you're using. Each version has differences, and you can use the validator at http://validator.w3.org to show you any errors, ranging from minor quibbles to syntax errors that will break your site.
  • browser compatibility -- Hopefully you're familiar with more than one browser. If you're not, you should become familiar with the most popular ones: Internet Explorer, Firefox, Safari, and Chrome. If your site looks good in any of the latter 3, chances are it will be just fine in the other 2. Dealing with IE compatibility will probably be an adventure to itself, and is just a part of web development (full disclosure: I work for Mozilla). If you expect the site you're building to see a decent audience, you should choose what browsers you want to support from the start. For an example of this, see Yahoo!'s Graded Browser Support matrix: http://developer.yahoo.com/yui/a... Front-end engineers learn all of the different browser quirks and can usually fix browser-specific issues with a few CSS changes, but hopefully you won't need to do that.
  • performance -- Little things like where you place JavaScript files or how many images you use can have a huge impact on how fast your website loads for users, especially users on slow connections. Check out Yahoo!'s Best Practices for website performance tips: http://developer.yahoo.com/perfo...

This entire answer, of course, is assuming you want to code by hand. You also have the option to use WYSIWYG (What You See Is What You Get) software to drag and drop elements of a website exactly where you want them, but these produce horrible code and you don't learn anything.

See Questions On Quora

Posted on 14 March 2010

reddit.com: search results

Understanding Javascripts role in development.

I have been a developer for a very long time, and I am struggling to understand what is happening with Javascript these days. I was always under the impression that javascript being clientside meant that it was mostly utilized for the interface. Lately I have been reading about react, node and a couple of other libraries and I am struggling to understand javascripts place in the world.

I am still using a backend language to do my data work, sometimes PHP, Python, and or .NET depending upon the client. I am doing mostly visual representation and a fair amount of form validation in javascript.

What is javascripts role in modern program development?

submitted by Bonejob to javascript
[link] [48 comments]

Posted on 20 March 2015

I'm making an RPG in JavaScript! Without canvas! Yes, I'm an idiot!

Update: I got a test version of the current build up and running if anyone wants to check it out!

Controls: Up/W, Down/D, Left/A, Right/D, Enter/Spacebar

Hello there! I am a budding JavaScript developer looking to make a name for himself (read: find employment), and so I decided making an RPG might be a fun way to test out my skills. It's far from finished, but I think I'm far along enough that I can share with people, and hopefully get some feedback!

The GitHub repo:

https://github.com/robobeau/JobInterviewStory

I'm also getting into the habit of making write-ups of the process:

http://jobinterviewstory.tumblr.com

I don't have screenshots, but here's a really quick video I posted just recently:

http://instagram.com/p/rmgJlySZpK/

I'm posting in /r/javascript primarily to get some constructive criticism on the code aspect of it, not so much the game design aspect. Also, this is technically my first GitHub repo, so if I messed up the setup instructions in any way, let me know.

Any and all feedback is welcome!

Edit #1: A clarification! I work primarily as a front-end developer and UI/UX designer. Hence, my DOM-only approach. I'm using this project as a way to hone my DOM manipulation skills, and have a little bit of fun while doing it!

Edit #2: After some of your feedback, I'm definitely going to refactor some of the code to stop relying on jQuery as a kind of framework.

Edit #3: Thanks for all the support, everyone! There's a lot of really good advice on this thread, and I'm gonna do my best to put it to good use!

submitted by robobeau to javascript
[link] [126 comments]

Posted on 12 August 2014

Do JavaScript app developers typically use object-oriented javascript?

I'm a Java Developer and i'm about to learn JavaScript and AngularJS. Do folks that make full-blown enterprise apps with things like AngularJS tend to use a lot of object-oriented JavaScript or not? I don't find the object oriented features of JavaScript to be very intuitive (i.e. prototypes etc). Do folk actually make a lot of prototypes and use inheritance etc?

submitted by vt97john to javascript
[link] [57 comments]

Posted on 14 July 2014

Why do so many Javascript libraries get this wrong?

And why does no one notice?

All too often I see a promising Javascript library follow this approach to creating classes:

function Library(a, b) { this.publicMethod = function() { return a + b; }; ...etc... } 

Instead of the superior prototypical way:

function Library(a, b) { this.a = a; this.b = b; } Library.prototype = { constructor: Library, publicMethod: function() { return this.a + this.b; } }; 

For those of you who don't understand the difference, in the first (non-prototypical) approach, every time you initialise a new Library object you also unnecessarily recreate every single method. If your class is instantiated a lot and/or has a large number of methods, this will lead to much heavier memory consumption. The other approach only creates the Library methods once to be reused in different contexts (the typical inheritance model), which is much better for memory.

Now the average jQuery plugin isn't going to see a whole lot of decrease in memory consumption by using the prototypical approach, but how has it not been the standard this whole time? It's clearly the intended way of creating anything like a class in Javascript.

I remember years back when I first started learning Javascript, every tutorial I found taught the former approach. I didn't even hear the word prototype until years later. Yet after all these years with Javascript maturing as it has I still run into recent GitHub projects that base it around the obviously inferior design approach. And no one even mentions it in the issues, even on ones with thousands of users and hundreds of contributors.

Maybe I'm missing something here...

EDIT: It seems I've stumbled upon quite a controversial topic in the Javascript community. A lot of really great points here, let's just try to not downvote comments only because we don't agree with them.

EDIT 2: It seems the general consensus is that they each have their appropriate uses. My views have definitely been challenged and I recognise that my opinion was a little flawed. This has been an excellent discussion, thank you!

submitted by poisondwarf to javascript
[link] [116 comments]

Posted on 2 April 2014

Is the option to disable Javascript in browsers outdated?

Do you think the option to turn Javascript off in most browsers is outdated?

It seems like more and more of elements of the user experience that users really like and find really useful, necessary, are dependent on Javascript. AJAX is the best example.

All of that gets bollixed up if someone shuts Javascript off. Yes, the programmer can detect if Javascript is enabled, but it seems out of date for browser makers to give the users the ability to shut off a major.....close to being a defacto standard technology, s/he may need.

submitted by cyanocobalamin to javascript
[link] [99 comments]

Posted on 12 August 2013

What are your vanilla JavaScript knowledge standards that every JS developer should know?

I have an interview coming up for a front end position. I have used JavaScript while at uni for the last 2.5 years and am familiar with Modular JavaScript and other design patterns. Also am familiar with scoping in JavaScript and ...inheritance.

What other things would you recommend I brush up on? Your help would really be appreciated!

submitted by js_coder to javascript
[link] [230 comments]

Posted on 7 August 2013

My javascript game as native application for Android, Windows / Linux / OSX

I will be writing some "How to" articles soon but for now I would like to share what I consider finished work - and spawn a few initial thoughts on different platforms / systems.

Quick vine/video of the game if you are wondering is it worth reading.

Link to the game is at the bottom of post - because I mostly want to share my bitter-sweet joy after spending 500+ hours on this title.

Technical details:

  • Done with canvas - supported by my unfortunately named library Canvas Query
  • No DOM/CSS rendering
  • Sound based on Audio element (no WebAudio API)
  • GamepadAPI - w3c/chrome specification

Windows / Linux / Osx - node-webkit

Very pleasant to work - absolutely nothing has to be tweaked. Managed to do both windows and linux packages under Ubuntu (using WINE). Unfortunately for Mac you need OSX. Also you need special build for OSX < 10.7 - alsooooooo your app will not get accepted in Ubuntu Store for Ubuntu > 12 because of some dependencies craziness

Android / IOS - CocoonJS

Everything goes rather smooth if you are creating the game with cocoon in mind from the start - no DOM, first canvas element is screen, some traps like audio.load - pros is that it is WAY faster (thanks to OpenGL) than PhoneGap and other solutions - also you don't need OSX, nor developers account in development process. Cons are that you will loose your hair searching for bugs that are not in your code.

I have failed to make port for IOS because imageData related functions are not working properly - also it kill the app randomly for some reason - also context.arc is broken on IOS.

CocoonJS will support Gamepad API which makes it possible to make OUYA games. If you can't get your game working on IOS - ejecta is an alternative.

Firefox OS

Deploying application is the easiest of all platforms - you just upload some manifest file and voila - no porting at all. However the OS is still too slow to render more complex games like QbQbQb - tho I've been able to run different one in built-in browser (which performance is no-different from native apps) with promising results (but that's not the topic).

Distribution

Currently my game is available on Humble (bundle) Store and Google play store, Newgrounds, Kongregate. Pending approval for Desura. Rejected by GOG and Rovio stars. Will be trying greenlight. However this is marketing - I am failing hard in this field so won't play wise guy :)

One advice: do not put DEMO in title on Kongregate - even if it is true :) They like/ask to be cheated by disguising demo as a normal version - and then full game is called "SUPER" or "HD" despite it has all the same assets.

I will be trying to find time to reveal little by little details on publishing on different platforms - especially how to build packages for android, ubuntu or making windows installers because this is something that javascript programmer may find extremely repulsive (I DID... it breaks the whole idea of HTML5 portability with browser as a vessel - and I am not yet sure was it the best business decision).

Also to show you a glimpse of how many twists are there check my distribution/ folder structure http://pastebin.com/raw.php?i=Wkb8XciR

The game:


|~o Click this o~|


Also - if you are currently porting html5 game and got stuck on something - ask - maybe I have encountered the same problem and managed to go through.

I will announce articles on /r/javascript but you can follow me on twitter or tumblr

submitted by rezoner to javascript
[link] [60 comments]

Posted on 4 August 2013

Javascript != Java

3rd-party contractor came to visit office yesterday, who has "decades" of experience. Conversation came up about JavaScript in one of our products. He says, "Our product doesn't use Java." After an awkward moment with someone who works on the knowledge base nodding in agreement with him, I speak up and delineate the difference between Java and JavaScript.

Later on in the conversation, the same 3rd-party guy followed up with this jewel: "besides, what would anyone even use JavaScript for on the web?"

I proceeded to disable Javascript in my browser and show him.

tl;dr: lasers, dinosaurs, & drums made a guy's head explode

[edit spelling]

submitted by raiderrobert to talesfromtechsupport
[link] [358 comments]

Posted on 22 May 2013

I'm trying to learn JavaScript, and all of the books I've looked at begin with a heavy dose of binary and memory allocation - is it really necessary to learn this??

I fully understand that in order to be a fantastic, brilliant programmer learning about how the computer converts your code and how much memory it takes to process it could be of benefit, but as a beginning programmer, I feel like it is a great waste of my time (for now) to know that the number 114 is made up of 64 bits. I'm feverishly trying to up my skill set so that I can move out of my horrific tech support job and into the world of programming, and in order to maximize my time, is it okay to skip over this or will it haunt me further down the line?

edit: Thank you for all the feedback, insight, and encouragement! I have ordered Professional JavaScript for Web Developers and The Definitive Guide from Amazon. They won't be here for another week, so in the meantime, I am 25 pages into homoiconic's book JavaScript Allonge (a very clever and informative read!) and I'm pressing on :)

submitted by have_u_restarted_it to javascript
[link] [131 comments]

Posted on 1 February 2013

If JQuery is so easy to implement, why learn vanilla javascript?

So im learning front end development as i go along, and i've been asked by some clients to include things like accordian and datepicker UI elements of JQuery. Im really struggling with the code academy exercises and am beginning to ask myself 'do i really need to learn vanilla javascript if everyones using libraries anyway?'. What possible use could vanilla have these days?

Also, should i be doing more than just doing the exercises on code academy? i.e read books on jscript/work on some sort of basic project?

Thanks

Edit : Why downvote? I've been doing front end coding for 2 months now so i really dont know that much. Help a guy out!

Edit 2 : Some great posts here guys. Thanks for you input. In hindsight I maybe should have stated my aspirations ; I dont desire to be a programmer. I don't find writing code for the sake of it fun, HOWEVER, I do get inspired by browsing www.thebestdesigns.com and seeing beautiful websites with such interactivity and fluidity. I want to be able to make visually stunning websites as opposed to soley being a 'programmer' in the traditional sense if you understand. Thanks again.

submitted by jsthrow to javascript
[link] [114 comments]

Posted on 8 November 2012

r/javascript is not Stack Overflow

I don't know how other users of r/javascript feel about this, but I think this should be a forum for discussion of Javascript itself and sharing interesting examples.

Every day new threads hit the top of the page which are just asking for help with, or critique of code. IMO, these kinds of posts belong in a different forum, preferably Stack Overflow, a link to which is posted right over there --->

Am I being a fusspot? How do other people feel about this?

submitted by mitchellrj to javascript
[link] [115 comments]

Posted on 23 October 2012

Learn Javascript

This subreddit is for anyone who wants to learn JavaScript or help others do so. Questions and posts about HTML and CSS are also encouraged. /r/LearnJavascript is sponsored by the folks at [Hack Reactor](http://www.catalystclass.com), a school specializing in teaching Javascript to fledgling programmers. HR staff members regularly post and respond to questions here. [link]

Posted on 4 April 2012

What program do you use to write Javascript?

I hope you guys don't get this a lot. Currently I'm using Dreamweaver code mode, but there's got to be a better tool out there for OO Javascript right?

Edit: Thanks for the advice guys, I'm going to give a couple of these a shot.

Also, I was going to ask for some up-votes, so that this would be more prominent on /r/javascript, but then I remembered it was /r/javascript. 2 is enough.

submitted by 90yoboy to javascript
[link] [138 comments]

Posted on 9 August 2011

Recommendations for mastering JavaScript.

I'm making it a goal of mine to master JavaScript and was hoping someone else had done the same and wouldn't mind sharing their regime.

EDIT: ** **I've created a new post to host all the references from this post. Find it here.

EDIT: Thanks guys. I've compiled a list of references mentioned here. I appreciate all your contributions.

  1. Anything written by Douglas Crockford. This includes: JavaScript: The Good Parts and YUI Theater
  2. Read other people's code, jQuery source, Node's source, etc.
  3. Understand JavaScript before becoming dependent on libraries (eg. jQuery, Prototype).
  4. Addy Osmani's Javascript 101 audio course
  5. Build Things - "think of something cool, and try and build it."
  6. Participate at StackOverflow.
  7. References -o- plenty: Gecko DOM Reference, HTML and DHTML Reference, Yahoo! YUI Theater, w3schools.com HTML DOM Tutorial, Annotated ECMAScript 5.1, JavaScript, JavaScript Blog

  8. And finally, Lord loves a working' man, don't trust whitey, and see a doctor and get rid of it.

submitted by fl0at to javascript
[link] [93 comments]

Posted on 21 February 2011

Javascript is NOT a bad language

Venting here. I'm sick of hearing that Javascript is a bad language. It's not perfect (what language is?) but it is quick and easy to write clean, flexible and reusable code. It's extremely well documented. It has some sweet debugging tools (these days). I love the powerful dynamic nature of it, and the event driven programming that it enables. Occasionally I sit down with people that "used to do some Javascript back in the day", people who were left with a bad taste in their mouth. Together we (ok, mostly me) hash out some clean, concise, and readable Javascript... and I laugh as they slowly realize that they don't know as much about it as they thought they did.

I love Javascript. It's the web browsers that I usually have issues with.

submitted by spiderworm to javascript
[link] [83 comments]

Posted on 29 December 2010

JavaScript

All about the JavaScript programming language! [link]

Posted on 24 January 2008