Simon Willison’s Weblog

Subscribe

640 items tagged “javascript”

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.

[... 137 words]

In simple terms, what is node.js?

It’s server-side programming, like PHP. The language you write the server-side code in is JavaScript (specifically the JavaScript version supported by Google’s V8 JavaScript engine, which was originally written for the Chrome web browser).

[... 46 words]

2013

What is the most succinct definition of a JavaScript callback, being more elaborative than simply “A function that calls another function.”?

A way of saying “once you’ve finished doing this, do that”.

[... 38 words]

What are the conference/meet-ups on JavaScript that accept guest speakers?

We have a crowdsourced list of JavaScript events that are accepting speaker submissions here: JavaScript conference calls for participation

[... 53 words]

Should a beginner to web development start out with Node.Js?

Maybe. One of the things I like about Node.js is that the raw abstraction it provides over HTTP is much closer to how the actual protocol works than the abstractions provided many of the more widely used frameworks such as PHP, Django or Rails. That might actually make it an effective learning tool—I’d be interested in hearing from some web developers who learnt Node.js as their first server-side technology.

[... 87 words]

How can you run image processing in cloud code (Parse) ? If parse is not the best

There are dozens of web-based image resizing APIs that could help with this. Check out http://www.imgix.com/ for example.

[... 42 words]

Is there any alternative to devbootcamp.com or hackreactor.com in Europe?

http://www.makersacademy.com/ are running a similar program in the Old Street area of London.

[... 30 words]

Beginner JavaScript: more code or quality code?

Write more code. The more code you have written, the better you’ll be able to understand why certain techniques for creating higher quality code are worthwhile later on.

[... 70 words]

How do I choose between asynchronous web frameworks? My tech group is fairly language agnostic and we’re trying to standardize on some technologies.

Since they are all pretty close to each other and it sounds like your tech group’s skills would support any of them, I would suggest having your tram build a simple prototype in all three so you can compare them for your own particular team and situation.

[... 76 words]

What are some JavaScript concepts that took you the longest to understand?

Closures, prototype inheritance, and the “this” keyword.

[... 60 words]

What are the design mistakes in the Meteor framework?

Treating the non-JavaScript case as unimportant.

[... 21 words]

How does a web page interact with a server to parse a dynamic JSON file?

If you’re only dealing with 60 records there’s no need to add a full database. I’ve actually hand coded a 50 record JSON file before and it was fine- use an editor with good JSON support (I like Sublime Text 2) and it’s pretty easy to hand write.

[... 103 words]

How do I get started with node.js?

You don’t run Node.js in a script tag on your website. Node is a technology for writing servers in JavaScript—you can think of it as a replacement/alternative for PHP, Python, Ruby, ASP.NET etc.

[... 58 words]

What are the strategies for a front end developer to keep up to date with the emerging technologies?

Step one: find developers who you respect and subscribe to their blogs, follow them on Twitter/Google+/etc and try to understand what they are talking about and what they think is exciting.

[... 139 words]

Why is node.js so much faster?

There are two main reasons.

[... 116 words]

2012

If I study HTML5, can I avoid having to learn javascript?

Many of the most exciting new features that fall under the term HTML5 only make sense in the context of JavaScript—things like Canvas, Web Workers, AppCache and so on. So no, you can’t learn HTML5 properly without getting familiar with JacaScript.

[... 60 words]

Can you mark items on a website as ’unread’ without cookies?

It’s not very exciting, but CSS will let you set different styles for visited vs unvisited links and the technique has worked reliably since the mid 1990s.

[... 44 words]

How difficult is to to learn a language framework, like node.js?

The answer varies enormously depending on the language and the framework. Some frameworks are very easy to pick up, others are harder.

[... 162 words]

What is a good cat name that relates to JavaScript?

I have two friends with cats that have names related to JavaScript. One is called “JavaScript” and the other is called “Widget”.

[... 38 words]

Wouldn’t an ASCII cellular automaton in javascript be the simplest starting point to teach/learn programming?

Absolutely not. The first step in learning to program is understanding that a computer can be quickly made to do something useful by executing lines of code. Personally I’m a big fan of firing up something with an interactive prompt (like Python, or even Firebug or the Google Chrome JS console) and demonstrating that typing a line of code hitting return will get a useful response.

[... 87 words]

How do you change page content and URL without reloading the whole page?

This can only be done using JavaScript. You use XMLHttpRequest to pull in new information from the server (also known as Ajax—most people use a JavaScript library such as jQuery to handle this) and then use the HTML5 history API, in particular the pushState method, to update the URL.

[... 133 words]

How can I parse unquoted JSON with JavaScript?

Unquoted JSON isn’t JSON—the JSON spec requires that strings are quoted (with double quotes, not single quotes).

[... 104 words]

Was CoffeeScript invented to help Ruby programmers get over that dirty yucky feeling they get when working in JavaScript?

The original Prototype JS library might fit that description—more than CoffeeScript, at any rate.

[... 41 words]

How long until Ruby developers are as cheap as PHP developers? is it already happening? should I still learn it or it only has a couple years left and I’m better off with SSJS?

If you want to be a highly paid engineer, you should worry less about your expertise in a specific language and more about developing broad and deep skills across a wider range of development topics.

[... 197 words]

How is JSON different then a JavaScript (programming language) object?

JSON is a carefully selected subset of JavaScript. A JSON object can only consist of dictionaries, strings, numbers (in JavaScript floating point and integers are treated as the same thing), lists, booleans and null. The spec on JSON.org is a good guide: http://json.org/

[... 119 words]

Is there a method to programmatically clear browser cache in JavaScript?

No.

[... 18 words]

Are there any performance drawbacks when rendering DOM views at runtime with JavaScript, rather than rendering server-sent HTML?

Yes, there is quite a significant impact on first-load performance. The browser has to pull down all of the linked scripts before it can display any content—if you’re using a library like jquery that’s a sizeable chuck of code that has to be loaded and executed just on its own.

[... 152 words]

2011

Does Quora use node.js?

Quora use their own event-based Python web framework which they’ve talked about quite a bit, called LiveNode. I believe it’s based on Tornado, the open source Python evented framework/appserver that was open sourced by Facebook after they acquired FriendFeed.

[... 49 words]

Qwery—The Tiny Selector Engine. A quarter of the size of Sizzle (1K gzipped and minified) due to only supporting ID, class and attribute selectors. Could be useful for things like embeddable widgets and badges, where depending on a larger library is impolite. # 2nd April 2011, 8:27 am

Before events took this bad turn, the contract represented by a link was simple: “Here’s a string, send it off to a server and the server will figure out what it identifies and send you back a representation.” Now it’s along the lines of: “Here’s a string, save the hashbang, send the rest to the server, and rely on being able to run the code the server sends you to use the hashbang to generate the representation.” Do I need to explain why this is less robust and flexible? This is what we call “tight coupling” and I thought that anyone with a Computer Science degree ought to have been taught to avoid it.

Tim Bray # 10th February 2011, 6 am