I know what you're thinking--why would you want to use Oracle for your node backend when you have perfectly good options like mongo and the like? You know the old saying: "When in Rome, etc.". The business enterprise is quite likely Rome, and Rome likes its Oracle, baby.
My coding buddy Aaron Frost tamed this beast (to mix metaphors), so credit where it's due. I mostly watched and told him to use "sudo" in a couple of places. In this article we'll walk you through how he did it using one of two available drivers (as of ...
BusterJs is a still-in-beta library that allows for testing your Javascript. It's got a wealth of cool features. The browser capturing is awesome for running your Javascript directly in the browsers you choose from one runner. You can also execute within Node. In short, it rocks. But, how to get this rockin' with your project, specifically your AMD RequireJs with BackboneJs combo project is the lock that must be opened before daily buster love can be had.
When you run a shell script or some other process from NodeJs and want to get the output in a stream to a client, you can redirect or pipe the output from the process that originally outputs to stdout into your socketio stream.
NodeJs can do many things. It can even run things that it can't do itself. For instance, I have a shell script that I don't want to rewrite in Javascript, so I want my Node app to run the shell script. No problemo.
Often when building a single-page app, you'll want to optimize all your js into a single asset. RequireJs is a great mechanism for managing your js dependencies. It also comes with a great build tool for doing the optimization (r.js). But sometimes you won't want to put all your js into a single asset. For instance, perhaps you only want to load a large chunk of code when the user interacts with the app so that you know he intends to use that functionality, and so you load it dynamically. But, you still want that dynamically-loaded set ...
Through long-available browser quirks/features, javascript has been available for requests across disparate domains. But, other resources, such as text files (eg, handlebars templates) have had more restrictions placed on them. Recently, CORS support has enhanced the ability to make these requests. Here's how you get your text files from another domain via requirejs.
HandlebarsJs is a great Javascript templating engine. It's pretty much Mustache templates on steriods -- or Rogaine or something like that. Well, there's a great for loop, but it'd be cool if it had a loop index built in. It doesn't have one as of the current version (1.0.0.beta.6). But, we can make an easy helper.
BackboneJs is a great resource for creating rich UIs. Rich means interactive. Interactivity grows when the client can do more of the work of an application itself, becoming more reactive and dynamic to user feedback, able to be more event-driven, and hopefully more quick and responsive. Here's a short history of how we've been creating rich UIs and a simple example of a rich UI in backbonejs
In developing a mobile web application, it would be ridiculous to avoid writing javascript unit tests. After all, they are simple to write and run. Recently, I implemented running our already existing Jasmine tests using PhantomJs and integrated this process into our continuous build environment. Works smooth!
If you have to store your text strings for internationalization (i18n) on the server, that's one thing. But, if you can store them in Javascript, you might think about using RequireJs and its i18n plugin, because it makes it nice and easy.
When you start writing applications with BackboneJS, that means that you're dealing with some dynamic UI. There are elements being pushed into and pulled out of the DOM. I was having problems trying to reference DOM elements that were dynamically inserted into the DOM by other Backbone views. The fix was simple but not immediately obvious without cracking open Backbone.
As more application logic gets pushed into the browser for client-heavy apps, the need for javascript testing increases. Lately, I've been doing some Jasmine unit testing of an application that uses RequireJS. Here are some general pointers and potential pitfalls to watch for.
Backbone has a great inheritance mechanism. It's as easy as Backbone.Model.extend(). This much is obvious. Let's try a few other things, like: Subclassing our own classes, calling to super classes, adding subclass attributes, and adding various subclasses to a collection based on a super class.
As web developers we're used to being able to write a jQuery selector and easily get the DOM elements back on the page that we're looking for. In the case of jQuery Mobile, it's slightly more complicated because a "page" is a different beast.
I've seen a number of different ways that internationalized strings get put into Javascript code. Of all of them, I kind of like just bundling the resource bundle of key value pairs in Javascript files themselves, one for each language or something close to that. But, in a recent project, there were a few other constraints, so we did it another way.
This is lacking. It's been one of the few disappointments I've had with WatiN. It does not handle XPath support out of the box. I found several other posts out there on the same issue with work arounds but we found a pretty slick solution using JavaScript-XPath.
Jquery has made developing javascript fun and enjoyable. It is a fantastic library that essentially allows the creation of library extensions on top of it via plugins. Jquery plugins are surprisingly easy to write and elegant to read and use. Here are a few tips on where to find good plugin candidates, design principles for plugins, and an outline of the basic structure that I have found most useful when writing plugins.
Let JQuery determine which radio button has been selected
Okay, Okay, I admit it. I'm javascript challanged. As a Java developer, I've looked down my nose at paltry javascript, treating it as a "me-too" technology trying to cash in on the hype surrounding java all these years.
As a result, I've missed out on a lot of js goodies. And, with javascript entering a renaissance of sorts, combined with the wildfire-like buzz surrounding libraries such as jquery, it's high time I learn some.
Jquery gives a great, easy-to-use mechanism for extending its API and creating your own plugins. For stuff that looks like it could be useful generally, you should really try to put it into a nice little plugin package. For submit buttons, there is a general thought that they shouldn't be clicked twice (especially for functions such as financial transactions), so I created a plugin that fits an app that I have been working on recently, where there are many, many submit buttons, saving very granual pieces of content through ajax requests.